Klausos Klausos
Klausos Klausos

Reputation: 16050

How to debug JSON files

There are several errors in my JSON file. What is the best option for debugging JSON files? I used this editor - http://www.jsoneditoronline.org/, but it's a bit difficult to use for long files.

For instance, the error message says:

Error: Parse error on line 1:
...000.0}]}},"data": [{"id": 0,"fr
-----------------------^
Expecting 'EOF', '}', ',', ']', got ':'"

But the line looks fine.

Upvotes: 3

Views: 17615

Answers (6)

Jonathan Applebaum
Jonathan Applebaum

Reputation: 5986

You can use Codverter JSON Validator, its online but it`s highly secure and everything you do is interpreted on your local computer and never sent back to the server. the validation error messages are informative and accurate.

(Full Disclosure: I am one of the developers).

enter image description here

Upvotes: 1

greenaj
greenaj

Reputation: 163

Why not try something like vim or Notepad++ and try matching the brackets and braces? You may need to use something to "pretty print" the JSON first. I believe you could do that from a Python console.

You may try something from here http://jsbeautifier.org/ to format in one-line JSON stuff.

Upvotes: 1

Tallisado
Tallisado

Reputation: 37

If you have access to Visual Studio. They have a visualizer debugging tool, which as such, will traverse the structure and throw at the problematic lines.

  • JSON Debugger Visualizer in Visual Studio 2013

Upvotes: 2

Ishan Chatterjee
Ishan Chatterjee

Reputation: 835

If you have access to NodeJS locally, there's a CLI tool that works well for linting JSON files: https://github.com/zaach/jsonlint

Otherwise, you can use JSONLint if you don't mind uploading your JSON to a "random" remote server.

Upvotes: 2

Chazu
Chazu

Reputation: 1018

I suggest entering your JSON into a linter such as http://jsonlint.com/. Additionally, properly formatting your JSON will make it easier to debug. A site such as http://jsonformatter.curiousconcept.com/ can do this for you.

Upvotes: 2

Tholle
Tholle

Reputation: 112787

Try putting your JSON file's content into a validator, like http://jsonlint.com/ or http://jsonformatter.curiousconcept.com/ and see what it says.

Upvotes: 2

Related Questions