OpenAPI JSON Validator

Paste the contents of your openapi.json or swagger.json file and get a structural check in seconds. The validator confirms the JSON parses, the version field is present, info has a title and a version, and paths exists, then warns about odd path names and unknown operation keys.

How to validate an OpenAPI JSON file

  1. 1

    Copy the file

    Open your `openapi.json` and copy the whole document, from the opening brace to the closing one.

  2. 2

    Paste it into the box

    Paste it into the OpenAPI / Swagger document field. No need to remove whitespace or reformat it.

  3. 3

    Run the check

    Continue to the results step to run the validation.

  4. 4

    Fix and repeat

    Edit the file for each error, paste it again and re-run until the report shows no errors.

Common JSON mistakes behind a failed check

JSON is stricter than YAML, so most failures on a hand-edited file come from syntax rather than from the API design. The usual causes are a trailing comma after the last property, single quotes instead of double quotes, a comment (JSON does not allow them), or a missing closing brace after a long paths object. A broken file typically ends in the message “Could not parse as JSON or YAML”, or in missing-field errors because nothing usable was read.

If you only see a parse error, find the syntax slip first. The structural checks run once the document reads as an object.

A worked example

Take this small document:

{
  "openapi": "3.0.3",
  "info": { "title": "Orders API" },
  "paths": {
    "orders": { "get": { "summary": "List orders" } }
  }
}

It parses, and the openapi field and paths object are present. The report would still show:

Finding Type Why
info.version is required. Error info has a title but no version
Path ‘orders’ should start with ‘/’. Warning The path key has no leading slash

Because there is one error, the document is not reported as valid. Add "version": "1.0.0" to info and rename the key to /orders. A second run clears both findings.

What a pass does and does not mean

A clean report means the skeleton is right. It does not follow $ref links, check schemas or confirm that every operation has responses. Treat it as a quick gate before you commit the file, then run a full linter for deeper rules.

A practical workflow for JSON specs

Keep the spec in version control and paste it here before each commit that touches paths. Because the check is quick, it works as a sanity step after merging changes from several people, when duplicated keys or a misplaced brace are most likely. If your JSON is generated by a build script, paste the generated output rather than the template, so you test what readers will actually receive. When the report is clean, share the file or hand it to a documentation generator with more confidence that the top-level structure is sound.

Frequently Asked Questions

No. Whitespace and indentation do not matter. Paste the file as it is.

Standard JSON does not allow a comma after the last item in an object or array, so the document cannot be read as JSON. Remove the comma and run the check again.

Yes. The version check accepts either an openapi field or a swagger field, so Swagger 2.0 and OpenAPI 3.x JSON files both go through the same structural check.

No. Findings are listed as messages, such as a missing field or a path name, without line numbers. Search your file for the key named in the message.

Related Tools

Tool available in other languages

Guides and use cases