0

My question is sort of stupid that why

JSON.stringify({"annotation": [{"x":1, "y":2}, {"x":1, "y":2}]})

does not return

{"annotation": [{"x": 1, "y": 2}, {"x": 1, "y": 2}]}

but returns

{"annotation":"[{\"x\": 1, \"y\": 2}, {\"x\": 1, \"y\": 2}]"}

and how can I get the first output?

2
  • 1
    In which browser are you having this behavior?. If it's a browser with no native JSON support, which library are you using? Commented Oct 18, 2010 at 20:52
  • I'm using the widely used library from, json.org/json2.js. This seems to be Prototype's conflict. Commented Oct 18, 2010 at 21:03

1 Answer 1

2

Are you using Prototype? This question may be related:

JSON.stringify() array bizarreness with Prototype.js

Sign up to request clarification or add additional context in comments.

1 Comment

I have had this problem without using Prototype.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.