I have a Ajax workflow where i read JSON string of length 10,000 – 50,000 in length. Now function i am using for parsing JSON into javascript Object is throwing exception and failing to execute the statement.
Is there some kind on limit on json string that can be parsed, or eval can execute ?
I have tried
- YUI JSON utility to parse and
- Also tried eval() and
- new Function(“return” + jsonString + “;”)() also.
But no luck ?
can anybody help me with this problem or suggest something.
Thoughts
It sounds like your JSON isn’t well-formed. Not seeing the JSON, it’s hard to diagnose, but these are the erors I see most often:
undefined…although the 2-4 of the above would actually work with the second and third ways you tried to evaluate the JSON, since
evalandnew Functionboth accept full Javascropt object literal notation, which has more quoting options and allows top-level arrays, functions, andundefined.“No single top-level object” example
Like XML, JSON requires a “root”, must be:
Dangling comma examples
and
Mismatched quote example