Toolsy
Back to blog

Tech

JSON formatter vs linter in CI

11 min read

A JSON formatter makes a blob readable (or squeezes it into one line). A linter (or validator) in CI fails the pipeline when the file is invalid or breaks schema rules. You need both jobs, but not in the same place. Paste into Toolsy’s JSON formatter when you are staring at an API response. Put jq, a schema validator, or your language’s strict parse step in GitHub Actions or GitLab CI so a bad fixture never merges. This article separates human formatting from automated checks, and points to fixture workflows with CSV to JSON.

Why teams confuse formatters with CI checks

Pretty JSON looks “fixed.” Indentation does not prove required keys exist, types match, or trailing commas are gone in the file on disk. A green eyeball in a browser tab is not a green build.

Developers paste production payloads into chat. Someone beautifies the paste, copies it into fixtures/, and skips validation. CI never parses the file as JSON, only stores it as text. The next integration test fails on a missing comma that the formatter would have flagged if anyone had run Parse.

Minify-before-commit habits also collide with review. Reviewers want pretty diffs; runtimes want compact payloads. Decide which form lives in git and which form you build at deploy time.

What a JSON formatter does well

The Toolsy formatter pretty-prints with indentation so nested objects are scannable. It minifies when you need a compact body for a request or a size-sensitive config. Invalid JSON surfaces a syntax error so you can fix the comma, quote, or brace it points at.

Everything runs in the browser. The product FAQ states nothing is uploaded and there is no daily limit. That makes it a good desk tool for debugging, not a secret store.

Formatter and “beautifier” mean the same job here: readable layout versus one-line minify.

Pretty print for debugging

Paste a one-line API response. Expand it. Search for the field you care about. Compare two responses side by side in two editor tabs after formatting both.

Share samples in tickets with pretty JSON so reviewers do not horizontally scroll a 4,000-character line. Redact tokens before you paste into any web UI; see Is it safe to upload documents online? for the broader habit (this tool stays local, but the ticket may not).

Minify for payloads and configs

Some gateways reject whitespace-heavy bodies in size-limited tests. Minify after you finish editing the pretty form. Keep the pretty file in the repo if humans maintain it; emit minified output in the build step when the runtime needs it.

Do not minify as a security measure. Removing spaces does not hide secrets.

What a linter or validator does in CI

CI should fail when JSON.parse (or your language equivalent) throws. That is the minimum bar. Stronger setups add JSON Schema, OpenAPI example validation, or custom rules (no additional properties, enum checks).

A formatter will not enforce “userId must be a string.” A schema linter will. Wire that into the same job that runs unit tests so fixtures and checked-in configs stay honest.

Keep the CI tool non-interactive. Browser formatters need a human. Pipelines need exit codes.

Syntax check versus schema check

Syntax: braces match, commas exist, strings are quoted. Any strict parse step covers this.

Schema: required fields, types, formats (date-time), and forbidden extras. Use JSON Schema, OpenAPI, or protobuf JSON mapping rules depending on the stack. Pick one source of truth and generate fixtures from it when you can.

Where fixtures come from

Spreadsheets often feed mock APIs. Convert rows with CSV to JSON, then validate the result in CI. The guide CSV to JSON for API mocks walks that path. Do not skip the parse step after a manual spreadsheet edit.

How to prepare JSON before you format or commit

Copy the raw response from the network panel, not from a log line that truncated the payload. Truncation looks like “broken JSON” when the real bug is a cut paste.

Strip BOM and smart quotes from documents that passed through Word or chat. Those characters break parsers in ways that look random.

Redact bearer tokens, session cookies, and PII before the sample lands in git or a ticket. Formatters do not scrub secrets.

Walkthrough: desk formatter, then CI gate

  1. Paste the payload into the JSON formatter.
  2. Click Pretty. Fix any syntax error it reports.
  3. Copy the clean sample into your editor or ticket.
  4. Add a CI step that parses every *.json fixture (and schema-validates if you have a schema).
  5. On failure, open the file locally, format again if needed, fix the data, and push.

For broader API wiring and keys, see the developer integrations complete guide. Formatting is the readability layer; integrations cover how Toolsy APIs and auth fit your app.

Local habit that matches CI

Run the same parse command on your laptop that CI runs. If CI uses jq empty file.json or python -m json.tool, use that before you push. The browser formatter is for understanding; the CLI parse is for the gate.

When Base64 shows up next to JSON

Some APIs wrap JSON in Base64 inside a parent field. Decode with Base64 first, then format the inner JSON. Do not Base64-encode ordinary JSON “for safety” in git.

How to check results and fix common errors

Missing commas between objects, single quotes instead of double quotes, and trailing commas (illegal in plain JSON) are the usual failures. The formatter’s error location is your first stop.

Duplicate keys may parse in some libraries and surprise you later. Schema validation or a strict linter policy catches more of those than a beautifier.

If CI fails only on one OS, check line endings and file encoding. JSON itself is Unicode text; a UTF-16 save from Notepad will confuse parsers expecting UTF-8.

Limits, privacy, and when not to use a web formatter

Toolsy’s formatter is free, private to your browser, and aimed at paste-sized documents. It is not GitHub Actions. It is not JSON Schema. It will not rotate secrets.

Do not paste production customer payloads into any tool if policy forbids it, even when the FAQ says nothing is uploaded. Use local CLI formatters on locked-down machines.

Huge multi-megabyte dumps may feel slow in a tab. Stream those through jq locally instead.

Frequently asked questions

What is a JSON formatter?

A JSON formatter adds spaces and line breaks so nested data is easy to read, and can minify back to one line. Toolsy’s JSON formatter does both in the browser. It reports syntax errors when the paste is not valid JSON. It does not replace a schema linter in CI.

How do I use a JSON formatter online for free?

Paste your JSON, choose Pretty or Minify, then copy the result. No account is required on Toolsy. Fix any error the tool highlights and try again. Keep secrets out of the paste when company policy requires it.

Can a JSON formatter fix broken JSON automatically?

It finds syntax problems and shows where parsing failed. You still repair the comma, quote, or brace. Some editors offer auto-fixes; treat those as suggestions and re-parse. CI should confirm the file on disk, not only a repaired paste.

What is the difference between a JSON formatter and a linter in CI?

A formatter helps a human read or compact JSON. A CI linter or validator fails the build when files are invalid or break schema rules. Use the formatter at your desk. Use parse and schema checks in the pipeline so bad fixtures never merge.

Is a JSON formatter the same as a JSON beautifier?

Yes in this product: pretty print makes JSON readable; minify removes extra spaces. Marketing pages use both names. Neither name means “schema validation.”

Should I commit pretty or minified JSON?

Prefer pretty JSON in git for human review, unless a tool requires minified input committed as-is. Generate minified artifacts in the build when size matters. Agree as a team so diffs stay readable.

How do I validate JSON in GitHub Actions?

Add a step that runs a strict parse over your fixture paths, then optionally a JSON Schema validator. Fail the job on nonzero exit codes. Keep the same command documented for local use. Pair fixture creation with CSV to JSON for API mocks when spreadsheets are the source.

Does the Toolsy JSON formatter upload my data?

No. The product FAQ states formatting runs in your browser and data never leaves your device. That is still a browser memory surface, so redact tokens. For integration patterns beyond paste tools, read the developer integrations complete guide.

Why does my JSON pass the formatter but fail CI?

CI may enforce schema rules, disallow trailing commas your editor tolerated, or parse a different file than the one you formatted. Compare paths and encodings. Run the CI parse command locally to reproduce.

When should I skip the browser formatter?

Skip it for huge files, locked-down secrets, and automated pipelines. Use CLI tools there. Reach for the browser when you need a fast read of a mid-sized response during debugging.

For spreadsheet-driven mocks, continue with CSV to JSON for API mocks. For API keys and wiring patterns, see the developer integrations complete guide.

Format or minify JSON

Paste JSON, pretty print or minify in your browser. Free, no sign-up, nothing leaves your device.

Open JSON formatter
Share this article

More to read

JSON formatter vs linter in CI — Toolsy