CodVerter's JSON Validator will check your JSON and tell you if it's valid or not. Here you can learn how it works.
Step 1: Insert JSON
Open CodVerter's JSON Validator and insert your JSON to the input editor. You can paste data, or drag and drop a JSON / text file.
Paste or drag and drop JSON data
Step 2: Test JSON Validity
Here's a sample of an invalid JSON, it contains data for a customer named John Black with his address and orders details:
{"id": 73759,
"firstName: "John",
"lastName": "Black",
"address": {
"street": "12 Grimmauld Place",
"city": "London",
"postalCode": 42290,
"country": "England" },
"orders": [
{"orderId": 54986315,
"quantity": 1,
"orderStatus": "complete"},
{"orderId": 43434534,
"quantity": 3,
"orderStatus": "complete"},
{"orderId": 43434533,
"quantity": 3,
"orderStatus": "canceled"} ] }
Sample of invalid JSON data
Paste it to CodVerter JSON Validator, press the "Convert" button and check why it's not valid.
Invalid JSON error message in CodVerter's JSON Validator
We got the following error message as output:
SyntaxError: JSON.parse: expected ':' after property name in object at line 2 column 16 of the JSON data
Invalid JSON error message
The error indicates that there's an issue with the property name in line 2. When looking at line 2 We can see that it's missing a double apostrophe (quotation mark) ".
Step 3: Fix Invalid JSON
Once we know what the issue is, we can fix it. Let's add the missing double apostrophe and try again.
{"id": 73759,
"firstName": "John",
"lastName": "Black",
"address": {
"street": "12 Grimmauld Place",
"city": "London",
"postalCode": 42290,
"country": "England" },
"orders": [
{"orderId": 54986315,
"quantity": 1,
"orderStatus": "complete"},
{"orderId": 43434534,
"quantity": 3,
"orderStatus": "complete"},
{"orderId": 43434533,
"quantity": 3,
"orderStatus": "canceled"} ] }
Fixed sample of invalid JSON data
CodVerter's JSON Validator without errors
Step 4: Display Valid JSON
Now that our JSON is valid, we have 2 ways to display it: Pretty JSON or Mini JSON.
Pretty JSON
In Pretty JSON, aka JSON beautifier, data is formatted and re-arranged by adding indentions and new lines after commas and brackets. Choose "Prettify JSON" and output data view will transform to a beauty JSON format.
Pretty JSON output
Mini JSON
In Mini JSON, data is formatted and re-arranged by removing all indentions and new lines, making it one line without indentions. Choose "Minify JSON" and output data view will transform to a compressed JSON format.
Mini JSON output
Step 5: Export Results
You can save the output to a text file on your computer by pressing the "Save" button, or to continue working on your data on Codverter's Text Editor by pressing "Continue in Text Editor".
We hope you find this useful. Feel free to
contact us
and to
join CodVerter's community.
Let's CodVert!
Author: Noga @CodVerterTeam
Date: 14 November 2018