douglascrockford / JSON-js

JSON in JavaScript
http://www.JSON.org/
8.69k stars 4.59k forks source link

Question: why not expose the JSON validation as public method. #95

Closed ayesham closed 7 years ago

ayesham commented 7 years ago

Curious to know why the validation for JSON isn't a method available via the JSON object, e.g. JSON.parse, JSON.stringify and JSON.validate or something similar.

douglascrockford commented 7 years ago

JSON.parse does that.

ayesham commented 6 years ago

Sorry to comment on this closed issue. But JSON.parse needs to be in a try/catch to verify a valid JSON string.