Possible Duplicate:
How to check if a string is a valid JSON string in JavaScript without using Try/Catch
The question was already asked here : How to check if a string is a valid JSON string in JavaScript without using Try/Catch. No valid answer was given, even the validated one wasn't answering the question.
So it seems the only way to not doing this using try/catches is via regexps; the regexp given in one of the answers was only validating against eval, so a simple string like "2001-05-06" would pass the regexp, even though it's not JSON.
So has anyone a good regexp to validate against a well formed JSON string ?
try .. catch? Seems quite legit to use, because it throws an exception when failed.try/catchinternally -- I 'm curious to know how you would justify adding tons of code and accepting the performance hit just so that you don't write a 3-line solution that does usetry/catch. And that's without considering that more code == more bugs at all.