w3resource logo


jsonlint

Validate JSON with JSONLint

rating Average rating 8 out of 10. Total 29 users rated.

<<PreviousNext>>

Description

In this page you will see how you can validate your JSON data using JSONLint.

What is JSONLint

JSONLint is an opensource project which allows you to validate your JSON data. Since when you are working with any programming language and JSON, if your JSON data is not properly formatted, it can cause error, it is better to validate your JSON data beforehand.

You can check your JSON data by simply copying it to the JSONLint online (http://jsonlint.com/).

JSONLint - the JSON validator

Example of validating JSON with JSONLint

We will take simple piece of code and with the help of JSONLint, we will validate that. Here is the code

{ "firstName": "Bidhan", "lastName": "Chatterjee", age: 40, "email":bidhan@example.com }

Upon copying this code in the JSONLint and pressing Validate button, it shows the following error :

JSONLint - showing validation error

So you can see that it shows you the line number and the kind of error occurred.

Here, it says that it says that 'age' must be written as a string on line number 3. So, we enclose age as "age" directly in the JSONLint and press validate button again.

Here is the output :

JSONLint - showing validation error 2

Now it says that the error is on line 5. It should be "bidhan@example.com" instead of bidhan@example.com. And after making that change it validates the JSON.

..

JSONLint - validatd JSON



<<PreviousNext>>