thoughtasylumTOOLBOX Preview Guides Use offline Automate Feedback

Tools › Data

Data Validator

Check JSON, JSON Lines, YAML, TOML, XML or CSV as you type, and JSON, YAML or TOML against a JSON Schema. The text is syntax-highlighted, and each problem is explained, listed with its line and column, and marked where it is.

About this tool What it's for, how to use it and an example

What it's for

Check that a JSON, JSON Lines, YAML, TOML or CSV file is valid, or that XML is well-formed, before you use it, and find exactly where it isn’t. The text is coloured as you type, every problem is listed with its line and column, and each one is underlined in the text.

For example, when a deployment fails because of a config file, paste it here to find the stray comma, the duplicated key or the badly indented line. Or paste an XML file that won’t load to find the tag that isn’t closed.

How to use it

Paste or type the text, or choose a file (you can also drop one on the page). It’s checked as you type.

  • Format is detected from the text, or you can choose it. Choosing a file picks the format from its extension (.svg, .plist, .xsd, .rss and similar count as XML, and .jsonl and .ndjson as JSON Lines). Your choice is remembered in this browser.
  • Each problem is listed under the text. Errors make the text invalid; warnings, such as a duplicate JSON key, are allowed but probably a mistake. Select Line …, column … to jump to it.
  • In the text, a problem is underlined from where it is to the end of its line, red for errors and amber for warnings. JSON errors say in plain words what’s wrong and how to fix it, such as a missing comma or a bracket that doesn’t match, and say when JSON Format can repair it.
  • Check against a JSON Schema: paste a schema (as JSON or YAML) and JSON, JSON Lines, YAML or TOML is also checked against it once it has no syntax errors. Each problem names the value by its JSONPath, such as $.items[2].price should be at least 0, not -1; in JSON and JSON Lines it’s also marked where the value is. A value that doesn’t fit a format (email, date, date-time, time, UUID, IPv4, URI, hostname) is a warning, since the standard treats formats as notes rather than rules.

Example

Paste this:

name: web
ports:
  - 80
  - 443
name: api

The tool detects YAML and reports Line 5, column 1 Error: Duplicated mapping key, because name appears twice. Change the second one to label: api and the text is valid.

Good to know

  • JSON is checked as strict JSON: comments, trailing commas and single quotes are errors. Duplicate keys are warnings, because most readers silently keep the last one.
  • XML is checked for being well-formed: tags closed in the right order, attributes quoted and not repeated, one root element, every & starting a reference such as &, and namespace prefixes declared. It isn’t validated against a DTD or schema (XSD). A DOCTYPE is skipped rather than checked, but having one allows entities it may declare, such as  .
  • JSON Lines (one JSON value a line, also called NDJSON) is checked a line at a time, so every bad line is listed, not just the first. A blank line is a warning, as some readers skip it and others stop. Several lines that are each a whole object or array are detected as JSON Lines.
  • JSON, YAML, TOML and XML checks stop at the first error, since what follows it can’t be read reliably. CSV lists every problem.
  • CSV is checked against RFC 4180: every row should have as many fields as the first, and quotes must be used properly. The delimiter (comma, tab, semicolon or pipe) is detected from the first line.
  • The schema check covers JSON Schema’s validation keywords (draft 2020-12, and the older drafts’ forms of them), including $ref within the schema and $anchor names. It doesn’t fetch schemas from other addresses, and unevaluatedProperties, unevaluatedItems and $dynamicRef aren’t checked; the message says when a schema uses them. Passing the check means the data fits the rules the schema states, not that the data is right.
  • Detection guesses from the text’s shape; choose the format if it guesses wrong. YAML is read as YAML 1.2, and TOML as TOML 1.0, using smol-toml.

Guides: Debugging a failing API call · Fixing sitemap errors · Why won't my JSON file load? · From a messy CSV to clean data · Moving contacts between contact apps

Check against a JSON Schema

    Built with The third-party code and data this tool uses, and their licences

    This tool runs on the following open-source work, copied onto this site and served from it:

    js-yaml 5.4.2
    Copyright
    Copyright (C) 2011-2015 by Vitaly Puzrin
    Licence
    MIT License
    Source
    github.com/nodeca/js-yaml
    smol-toml 1.9.0
    Copyright
    Copyright (c) Squirrel Chat et al.
    Licence
    BSD 3-Clause License
    Source
    github.com/squirrelchat/smol-toml

    Every page also uses Montserrat (SIL Open Font License 1.1).
    Everything the site uses is on Credits and licences.

    Private: this tool runs in your browser. Nothing you type, paste or choose leaves this page.

    Saved you a few minutes? Say thanks with a coffee.

    Something wrong with this tool, or missing from it? Report a bug or suggest a feature.

    ↑ ↓ move↵ openesc close