OK,

to be standard I will go for the ticked way. Never the less I think it is
unfortunate that JSON forces the name to be ticked. The JSON document gets
less readable and more annoying to write.



Shawn Grover wrote:
> 
> 
> This all depends on where you are generating and using the json string.
> 
> Doing
>    { key : "value" }
> 
> and then using that code immediately on the same page, typically works
> fine.
> 
> However, if you ever need to pass your json string to/from a server, 
> you'll find that this "shortcut" fails quite often.
> 
> For instance, using this shortcut to request information via $.ajax(), 
> often gives an odd error.  While the request has a 200 status (meaning 
> the request succeeded without error), the error handler function (if 
> specified) would trigger - even though it "appears" the json is correct. 
>   (disclaimer - I haven't done this since 1.2.x days, so don't know if 
> it's still the case)
> 
> To avoid these errors, use the "standard" and do
> 
>    { "key" : "value" }
> 
> especially when passing json via an http request (i.e to/from a server). 
>   You'll have fewer problems in the long run.
> 
> My thoughts.
> 
> Shawn
> 
> 
> aldana wrote:
>> 
>> i often see two different json styles to have names:
>> 
>> { key : "value" }
>> 
>> vs
>> 
>> { "key" :"value" }
>> 
>> 
>> looking at official sites only option 2 is correct syntax, never the less
>> most of the tools do also handle option 1 and don't moan about the
>> syntax.
>> 
>> what you say, does it in practice not matter which option you choose?
>> 
>> generally i favor option 1 because it is not polluted with the "". i
>> wonder
>> why this syntax wasn't official from the start....
>> 
>> thanks 
>> 
>> -----
>> manuel aldana
>> aldana((at))gmx.de
>> software-engineering blog: http://www.aldana-online.de
> 
> 


-----
manuel aldana
aldana((at))gmx.de
software-engineering blog: http://www.aldana-online.de
-- 
View this message in context: 
http://www.nabble.com/json-syntax-question-%28ticket-vs-unticked-names%29-tp23441608s27240p23442738.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to