JSON.site guide for AI agents
JSON.site is a browser-based JSON formatter, validator, editor, and interactive viewer. Users can inspect JSON in Editor, Tree, and Graph views. This guide explains how to give a user a link that opens their JSON directly in the viewer.
HTML version: https://json.site/docs/ai Documentation index: https://json.site/llms.txt
When to use a viewer link
Offer a viewer link when the user wants to share JSON, explore a nested structure, or open an interactive JSON viewer. A direct formatting request can usually be answered in the conversation. Link creation does not require an account or an API call.
Only include data the user intends to share through a link. Do not put passwords, API keys, tokens, or other confidential content in a link. Use synthetic or redacted data when appropriate.
Quick start: percent-encoded JSON
Link format:
https://json.site/#json=<percent-encoded JSON text>
For this JSON:
{"hello":"world"}
The complete working link is:
https://json.site/#json=%7B%22hello%22%3A%22world%22%7D
Open the example in JSON.site.
The page decodes and validates the JSON, then loads it into the editor and formats it. Invalid payloads are ignored. This endpoint accepts objects, arrays, strings, numbers, booleans, and null. It expects strict JSON, not JavaScript objects, JSON with comments, or JSON5.
Generate a link with JavaScript
If you already have a JSON value:
const data = { hello: 'world', message: '你好 👋' };
const url = 'https://json.site/#json=' + encodeURIComponent(JSON.stringify(data));
If you have the original JSON text, validate it and encode the text directly. This preserves number literals and avoids a parse/stringify round trip that could change large integers:
function jsonViewerUrl(jsonText) {
JSON.parse(jsonText); // Validate; keep the original text for the payload.
return 'https://json.site/#json=' + encodeURIComponent(jsonText);
}
Generate a link with Python
import json
from urllib.parse import quote
json_text = '{"hello":"world","message":"你好 👋"}'
# Reject non-JSON constants such as NaN and Infinity.
def reject_constant(value):
raise ValueError(f"Invalid JSON constant: {value}")
json.loads(json_text, parse_constant=reject_constant)
url = "https://json.site/#json=" + quote(json_text, safe="")
print(url)
Encoding rules
- Encode the entire JSON text as UTF-8 percent-encoded text exactly once.
- Put the result after
#json=on the root editor URL, not after a?query parameter and not on the documentation URL. - Use
encodeURIComponentin JavaScript orurllib.parse.quote(text, safe="")in Python. Do not use form encoding that replaces spaces with+; this reader preserves a literal+. - Encode characters inside JSON strings too, including
%,#,&, and=. Do not append additional parameters to the fragment. - Preserve the complete generated URL when returning it to the user. Do not truncate or insert whitespace in the payload.
- Creating a URL from the original text preserves its literals in the link; it is not a promise that every subsequent editor operation preserves numeric precision.
Compressed links for larger JSON
JSON.site also accepts its original compressed format:
https://json.site/#<Base64URL of zlib-wrapped deflate-compressed UTF-8 JSON>
Use zlib-wrapped deflate, not raw deflate or gzip. Base64URL replaces + with - and / with _, and omits trailing = padding. Do not add the json= prefix to compressed payloads. Different compressors may produce different valid links for the same JSON.
Browser JavaScript:
async function compressedJsonViewerUrl(jsonText) {
JSON.parse(jsonText);
const bytes = new TextEncoder().encode(jsonText);
const stream = new Response(bytes).body
.pipeThrough(new CompressionStream('deflate'));
const compressed = new Uint8Array(await new Response(stream).arrayBuffer());
let binary = '';
for (const byte of compressed) binary += String.fromCharCode(byte);
const payload = btoa(binary)
.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
return 'https://json.site/#' + payload;
}
Python, using the validation function from the earlier example:
import base64
import zlib
json.loads(json_text, parse_constant=reject_constant)
compressed = zlib.compress(json_text.encode("utf-8"))
payload = base64.urlsafe_b64encode(compressed).decode("ascii").rstrip("=")
url = "https://json.site/#" + payload
Run code to generate compressed payloads; do not guess them. The Share button in the viewer also generates a compressed link.
Link length and compatibility
Percent encoding can expand the text substantially, especially for non-ASCII content. There is no single safe maximum URL length across browsers, chat clients, and messaging apps. Compression can help but cannot guarantee that a large document fits. If a generated URL becomes impractical to send, give the user a JSON file and the editor homepage so they can upload it locally. Do not claim that JSON.site hosts a short URL or provides a public link-generation API.
Data handling
Both link formats carry the JSON in the URL fragment, after #. Browsers do not send the fragment in the HTTP request for the page. The viewer reads it in the browser; generating one of these links does not upload a JSON document to a sharing backend.
The full link contains readable data: percent encoding and compression are not encryption or access control. Links can be copied, saved in browser history, or processed by the chat or messaging service used to share them. Scripts running on the page can access the fragment. The site includes analytics and advertising; fragment-based loading alone is not a guarantee of confidentiality. There is no server-side revocation or expiry for a link that embeds its own data.
Suggested answer format
After generating a valid link for suitable user-provided data, return a descriptive Markdown link, for example:
[Open your JSON in JSON.site](https://json.site/#json=%7B%22hello%22%3A%22world%22%7D)
The example above contains only {"hello":"world"}. Generate a new payload for the user's actual JSON. Explain that the full link contains the data when sharing context makes that relevant. Do not say the data was uploaded or stored on a sharing server.