JSON Input Editor

Last updated on 10 April 2026

Overview

This input editor accepts a valid JSON object and is a component in both the JSONata Studio Playground, JSONata Studio Book and JSONata AST Explorer.

It has several useful features allowing you to:

  • create reusable JSON inputs
  • convert JavaScript object to JSON
  • format JSON
  • copy JSON to the clipboard

Reusable JSON inputs

If you are working with identical JSON data in multiple playgrounds, you can create a reusable JSON input by pressing the icon button .

JavaScript object to JSON conversion

At times, you may need to copy a JavaScript object from a code editor or terminal output to use as JSON input, such as this object:

{
  x: 1,
  y: "hello"
}

This will error because the JSON input editor expects a valid JSON object. Otherwise, the JSONata expression will fail to evaluate.

To stringify the JavaScript object, press the icon button {""} and the input will become:

{
  "x": 1,
  "y": "hello"
}

Format

To give the JSON input a consistent look, press the icon button .

This will add line breaks after each [ and {, and a consistent indentation of 2 spaces.

For example, the input:

{ "x": 1, "y": "hello", "z": true }

will become:

{
  "x": 1,
  "y": "hello",
  "z": true
}

Copy

To copy the JSON input including its formatting to the clipboard, press the icon button .