Loading ...
Sorry, an error occurred while loading the content.

1426Re: [json] Re: json2 vs FF3 behaviour - jsonstring in array

Expand Messages
  • Alexandre Morgaut
    Dec 17, 2009
      JavaScript provides automatic type conversions on a lot of action

      So if you do

      var foo = ["bar"] + " baz";

      ["bar"] will be converted into "bar" and you'll have foo === "bar baz"

      you can also see that in JavaScript ["foo"] == "foo"

      and String["foo"]) === "foo"

      Then when you send an array to a function expecting a string, and this function doesn't check the type of the parameter ( or force it to string), you'll have what you get

      Le 17 d�c. 2009 � 11:45, nostalgiker a �crit :

      okay, i figured that out ;) bwt it's a plain javascript array, not java.

      but i was actually wondering why IE8 and FF3.5+ allow this with their native JSON objects - passing an array with one element to parse()

      so does the jquery.json pluggin - which is unmaintained. that is why i switched to json2... where i noticed that it doesnt support this, but everybody else seems to.

      [Non-text portions of this message have been removed]
    • Show all 13 messages in this topic