Validate JSON syntax

Check whether a text value is strict JSON and report its root type and size.

freeworks offlinenothing uploaded
ToolJSON Validator
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The text is parsed with JSON.parse; valid input reports its root type and serialized size, while parser errors expose the available message and location. No schema constraints are applied.

  • Any JSON root value is allowed.
  • Syntax checking remains separate from application validation.

Worked example

Valid JSON
A well-formed JSON object passes validation
Input
											{"name": "Alice", "age": 30, "active": true}
										
Output
												Valid: yes
Type: object
Size: 3
											

When to use this

API response checks, CI fixture gates, and configuration validation use strict syntax checks.

Edge cases

  • A top-level number or string is valid JSON even when an API expects an object.
  • Trailing commas are rejected by strict JSON syntax.
  • Comments cause an error rather than being stripped.

References