Skip to content
snowkitDev

Validate, query and mock your JSON

Check a JSON document against a JSON Schema and see exactly which field is wrong and why, try JSONPath expressions with live results, or turn a schema or a sample into as many realistic test records as you need.

Validate against a schema

Your JSON and the JSON Schema it should match.

draft 2020-12 or 07

    Checked as you type

    Check JSON against a schema, pull values out with JSONPath, and make realistic test data, all in your browser. Nothing is uploaded, so it is safe for private data. It is free and needs no account.

    How to use the JSON toolkit

    1. Open the Validate, JSONPath or Mock data tab. Load the example shows a working set.
    2. Validate: paste your JSON data and a JSON Schema, press Tidy both to format them, and read the problems listed.
    3. JSONPath: paste your JSON, type a JSONPath expression, and read the result. Show paths adds the location of each match, and Copy result takes it away.
    4. Mock data: paste a schema or a sample record (or Try a sample record instead), set the number of Records and a Seed, and choose the Output: JSON array, NDJSON (one per line) or CSV.
    5. Press Copy or Download.

    What the validator checks

    The core keywords from JSON Schema draft 2020-12 and draft 07: type, properties, required, additionalProperties, patternProperties, items and prefixItems, enum, const, number and length limits, pattern, uniqueItems, contains, oneOf, anyOf, allOf, not, if/then/else, and $ref to local definitions such as #/$defs/address. Formats checked are email, uri, date, time, date-time, uuid, ipv4, ipv6 and hostname. Every problem is listed with its path, like $.items[2].price, so you can find it fast.

    JSONPath in short

    $ is the root, .name picks a key, ..name searches at any depth, * matches everything, [0] and [-1] pick by position and [0:3] takes a slice. Filters such as [?(@.price < 10)] keep items that pass a test; you can compare with ==, !=, <, >, match a regular expression with =~ /text/i, check that a key exists with [?(@.isbn)], and combine tests with && and ||.

    Realistic mock data

    Paste a schema to get records that pass it, with numbers inside your minimum and maximum, strings that fit their length, pattern and format, and values picked from each enum. Paste a sample record instead and its shape is copied. Field names guide the values, so email, first_name, city, price, created_at and is_active get believable content, and emails match the names in the same record.

    Tips

    • Use the same seed to get the same mock data again, which makes tests repeatable.
    • When validation fails, fix the first error and check again, since one mistake can cause several.
    • Start with the JSONPath $..name to search a large file for a key you know.
    • Use NDJSON output for tools that read one record per line.

    Who uses it

    Developers testing an API, analysts pulling fields from an export, and students learning JSON. Related tools: JSON to types, format converter and diff checker.

    Questions

    Is my JSON uploaded?

    No. Everything runs in your browser.

    Which schema versions are supported?

    Draft 2020-12 and draft 07, for the keywords listed above.

    Is the mock data real?

    No. It is made up, so it is safe to share and use in tests.

    Where to next

    Carry on with what you just made, still on your device.

    More from Snowkit