How to validate JSON structure?

how to do proper json structure validation that provides the user a proper error message that shows them that they are missing a comma or any syntax error. @chrismccord , @josevalim

Hi, there is no need to @ individual people when first asking questions, please don’t do that.

Can you provide more information? You talk about a user, what user? Are you accepting JSON as a form input?


Yes I am using JSON as a form input. The validation of JSON object against the JSON schema using JsonXema dependency works, however the issue is structure validation. So I want to validate if there is a comma missing in the json object or any other syntax error within the json object. Thereafter I want to display a message to explain the error is this specific syntax error and which line the error occurred if possible.

You could use Jason.decode. I think it returns the error as well as the position when invalid JSON is provided.