JSON Editor

View, edit, and format JSON data with syntax highlighting and save formatted JSON to file

JSON Editor

Loading...

All processing happens in your browser. Your data is never sent to any server.

About JSON

JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write and easy for machines to parse and generate.

Key features of JSON:

  • Text-based format: JSON is language-independent and uses conventions familiar to programmers of the C-family of languages.
  • Simple structure: JSON is built on two structures - a collection of name/value pairs (object) and an ordered list of values (array).
  • Universal support: Almost all programming languages have built-in functions or libraries to parse and generate JSON.
  • Human-readable: Unlike binary formats, JSON is easy to read and edit manually.

This tool helps you work with JSON data client-side, with all processing happening in your browser for privacy and security.

JSON Format Examples

Here's an example of a JSON object representing a person:

{
  "name": "John Doe",
  "age": 30,
  "isActive": true,
  "address": {
    "street": "123 Main St",
    "city": "Anytown",
    "zipCode": "12345"
  },
  "phoneNumbers": [
    {
      "type": "home",
      "number": "555-1234"
    },
    {
      "type": "work",
      "number": "555-5678"
    }
  ]
}

Common JSON data types:

Data TypeExampleDescription
String"Hello, world!"Text enclosed in double quotes
Number42, 3.14159Integer or floating-point
Booleantrue, falseLogical true or false values
Object{ "key": "value" }Collection of key-value pairs
Array[1, 2, 3]Ordered list of values
NullnullRepresents no value

Using JSON in Different Languages

Here are examples of how to work with JSON in different programming languages:

JavaScript:


// Parse JSON string into an object
const jsonString = '{"name": "John", "age": 30}';
const obj = JSON.parse(jsonString);
console.log(obj.name); // "John"

// Convert object to JSON string
const person = { name: "Jane", age: 25 };
const json = JSON.stringify(person);
console.log(json); // '{"name":"Jane","age":25}'
                

Python:


import json

# Parse JSON string into a dictionary
json_string = '{"name": "John", "age": 30}'
data = json.loads(json_string)
print(data["name"])  # "John"

# Convert dictionary to JSON string
person = {"name": "Jane", "age": 25}
json_string = json.dumps(person)
print(json_string)  # '{"name": "Jane", "age": 25}'
                

Java:


// Using Jackson library
import com.fasterxml.jackson.databind.ObjectMapper;

// Parse JSON string into an object
String jsonString = "{\"name\": \"John\", \"age\": 30}";
ObjectMapper mapper = new ObjectMapper();
JsonNode node = mapper.readTree(jsonString);
String name = node.get("name").asText();  // "John"

// Convert object to JSON string
Map<String, Object> person = new HashMap<>();
person.put("name", "Jane");
person.put("age", 25);
String json = mapper.writeValueAsString(person);