Eval or Ext.decode or JSON.parse all function issue in Chrome when String has mutiple whitespaces

107 views
Skip to first unread message

Jaikar Ss

unread,
Aug 12, 2015, 11:42:51 AM8/12/15
to Chromium-discuss

We have String which we want to convert to JSON . We're using function Ext.JSON.decode('{'\Narration'\ : \'Test Test blah \''}') 



Double white spaces between string is converted "Test Test blah". All white space getting removed . Is it Bug from ur side or google chrome 



Version Google Chrome : Version 44.0.2403.52 beta-m 


Please help us

--- ---

PhistucK

unread,
Aug 12, 2015, 12:49:15 PM8/12/15
to jaik...@gmail.com, Chromium-discuss
Your code and your JSON string have syntax errors, so I am not sure how to help.


PhistucK


--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discu...@chromium.org.

Jaikar S S

unread,
Aug 12, 2015, 1:09:50 PM8/12/15
to PhistucK, Chromium-discuss
Hi ,

Here is Example to try   in Google version i mentioned .



Ext.JSON.decode("{\'Narration\' : \'Test    Test blah \'}")


See the screen shot below

Christian Biesinger

unread,
Aug 12, 2015, 1:11:50 PM8/12/15
to jaik...@gmail.com, PhistucK, Chromium-discuss
There is no Ext object in Chrome. I guess it's part of a library you're using, so you'll have to talk to whoever authored that library.

-christian

Jaikar S S

unread,
Aug 12, 2015, 1:15:22 PM8/12/15
to Christian Biesinger, PhistucK, Chromium-discuss
Hi


Try With Eval or JSON.parse

PhistucK

unread,
Aug 12, 2015, 1:25:59 PM8/12/15
to Jaikar S S, Christian Biesinger, Chromium-discuss
Yes, I see the issue now. It is only a display issue.
The Developer Tools feature shows you an object preview and I guess, in order to show as much data as possible, it cleans the white space.
JSON.parse("{\"f\":\"p       p\"}")
// Object {f: "p p"}
JSON.parse("{\"f\":\"p       p\"}").f
// "p       p"
As you can see, the actual value has whitespace.

I am not sure whether it is a bug or a feature, but google-chrome-developer-tools is more suited for this discussion.


PhistucK

Jaikar S S

unread,
Aug 12, 2015, 1:29:16 PM8/12/15
to PhistucK, Christian Biesinger, Chromium-discuss
No It's not display issue . When assign to variable whitespace are getting removed . As shown in the below screen. What should we do

PhistucK

unread,
Aug 12, 2015, 1:33:28 PM8/12/15
to Jaikar S S, Christian Biesinger, Chromium-discuss
It is a display issue - did you even bother to try and run the commands I quoted?
The result of the second command clearly shows that the value assigned to the key preserved the original whitespace.


PhistucK

Jaikar S S

unread,
Aug 12, 2015, 1:41:07 PM8/12/15
to PhistucK, Christian Biesinger, Chromium-discuss
Yes I did it . Your Example Work but Inside the jsonobject still i feel whitespace been removed and search inside the JSONObject i don't get result

Let me share you example

PhistucK

unread,
Aug 12, 2015, 1:44:05 PM8/12/15
to Jaikar S S, Christian Biesinger, Chromium-discuss
Please, continue the discussion at google-chrome-developer-tools.


PhistucK

Yang Guo

unread,
Aug 13, 2015, 2:08:16 AM8/13/15
to Chromium-discuss, phis...@gmail.com, cbies...@chromium.org
Reply all
Reply to author
Forward
0 new messages