What happens if I use JSON.parse on an invalid string? Will it return an error code, or just break the script?
Is the behavior consistent across browsers? And for older browsers, does json2.js also have the same behavior?
Context: my script is collecting JSON strings from different sources and parses them. If a string is not well formed, I want my script to ignore it and move to the next.
It will throw a catchable error. On proper browsers, it is a
SyntaxError. JSON2’s implementation mirrors this.