Swagger JSON Formatter

Runs in browser Web

Pretty-print Swagger 2.0 JSON, detect the spec version, list endpoints and definitions, and convert to YAML.

Privacy: This tool runs entirely in your browser. Your input never leaves your device.
Loading tool…

How to use Swagger JSON Formatter

  1. Paste the Swagger 2.0 JSON.
  2. Choose pretty JSON, minified JSON or YAML and whether to sort paths and definitions.
  3. Copy the formatted document and review the endpoint and definition tables.

Swagger JSON Formatter features

  • Pretty-print, minify or convert Swagger 2.0 JSON to YAML
  • Version detection with clear warnings for OpenAPI 3.x or non-spec JSON
  • Endpoint inventory (method, path, operationId, summary, tags, response codes) and definitions table
  • Base URL assembled from schemes, host and basePath
  • Structural validation problems listed alongside the formatted output

Swagger JSON Formatter example

Inventory a Petstore spec

Input:

{"swagger":"2.0","info":{"title":"Petstore","version":"1.0.5"},"host":"petstore.swagger.io","basePath":"/v2","paths":{"/pet/{petId}":{"get":{"operationId":"getPetById",…}}}}

Output:

Specification: Swagger 2.0 · Base URL: https://petstore.swagger.io/v2
Endpoints: GET /pet/{petId} getPetById — responses 200, 404
Definitions: Pet (object) — id, name, status

Frequently asked questions about Swagger JSON Formatter

What is the difference between Swagger 2.0 and OpenAPI?

Swagger 2.0 was renamed OpenAPI 2.0 when the specification moved to the Linux Foundation. OpenAPI 3.x restructured it: host/basePath/schemes became servers, definitions became components.schemas, and body parameters became requestBody. This tool targets 2.0 documents but formats 3.x too.

What does the endpoint table show?

Every operation with its method, path, operationId, summary, tags and documented response codes — a quick inventory for reviews and test planning.

Can I minify instead of pretty-print?

Yes. Choose "Minified JSON" to produce the smallest valid document, useful for embedding in configuration or API gateways.

Does it convert Swagger 2.0 to OpenAPI 3?

No — it formats, sorts and converts between JSON and YAML only. Use a converter such as swagger2openapi for the structural migration, then validate the result with the OpenAPI Validator.