Free Online JSON Format Validator

Input:
Output:

What is JSON?

JSON (JavaScript Object Notation) is a lightweight, text-based format for data interchange. It’s easy for humans to read and write, and simple for machines to parse and generate. JSON uses key-value pairs, objects ({}), and arrays ([]), supporting six data types: string, number, boolean, array, object, and null. Widely used in APIs and configuration files, JSON is language-independent and supported by most programming languages.

{
  "name": "JavaScript",
  "creator": "Brendan Eich",
  "year": 1995,
  "extensions": [".js", ".mjs"]
}

Use Cases for JSON

JSONPath Syntax

Here are syntax and examples adapted from Stefan Goessner's original post introducing JSONPath in 2007.

JSONPathDescription
$The root object/element
@The current object/element
.Child member operator
..Recursive descendant operator; JSONPath borrows this syntax from E4X
*Wildcard matching all objects/elements regardless their names
[]Subscript operator
[,]Union operator for alternate names or array indices as a set
[start:end:step]Array slice operator borrowed from ES4 / Python
?()Applies a filter (script) expression via static evaluation
()Script expression via static evaluation

JSONPath Expressions Examples

Given this sample data set, see example expressions below:

{
  "store": {
    "book": [
      {
        "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
      }, {
        "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99
      }, {
        "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99
      }, {
         "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
      }
    ],
    "bicycle": {
      "color": "red",
      "price": 19.95
    }
  }
}
JSONPathDescription
$.store.book[*].authorThe authors of all books in the store
$..authorAll authors
$.store.*All things in store, which are some books and a red bicycle
$.store..priceThe price of everything in the store
$..book[2]The third book
$..book[(@.length-1)]The last book via script subscript
$..book[-1:]The last book via slice
$..book[0,1]The first two books via subscript union
$..book[:2]The first two books via subscript array slice
$..book[?(@.isbn)]Filter all books with isbn number
$..book[?(@.price<10)]Filter all books cheaper than 10
$..book[?(@.price==8.95)]Filter all books that cost 8.95
$..book[?(@.price<30 && @.category=="fiction")]Filter all fiction books cheaper than 30
$..*All members of JSON structure

JSON Tutorials and Guides

  1. How to Format JSON:Paste your JSON data, select indentation (2, 3, or 4 spaces), and click “Format” to beautify it.
  2. How to Validate JSON:Input your JSON to check for syntax errors.
  3. Parsing JSON in JavaScript::Use JSON.parse to convert JSON strings to objects and JSON.stringify to convert objects back to JSON.

Features

Frequently Asked Questions

  1. How do I use the JSON formatter? Paste your JSON into the input field and click “Format” to beautify it.
  2. What if my JSON has errors? Our validator will highlight syntax errors and provide correction suggestions.
  3. Does the tool support JSON Schema validation? Yes, upload or input a JSON Schema to validate data structures.
  4. Is there a mobile version? Our tool is responsive and works on all devices, including mobile.