Contents

Sending malformed JSON to an API can cause rejected requests, confusing server errors, or silent failures that are hard to debug. Before a payload reaches an endpoint, it is worth checking that the JSON is syntactically valid and formatted consistently. FormatBits offers a json-format tool for syntax and formatting checks, plus url-codec and timestamp-convert for related API input preparation. This guide describes what to paste into json-format, what the result pane returns, how to interpret validation messages, and how to combine the enabled tools into a repeatable pre-submission workflow. The descriptions below are limited to what the tool source text confirms; they do not imply fixed prices, booking requirements, transport needs, or opening hours.
JSON validator inputs and outputs
Before sending JSON to an API, readers can use json-format to check whether the pasted text is valid JSON and see how it will appear after formatting. Paste JSON text into the editable source field. The interface labels it JSON UTF-8 with a 256 KiB maximum and starts at 0 bytes until input is added. The syntax check runs when the reader presses Ctrl or Command plus Enter after adding JSON.
When processing finishes, the result pane shows formatted JSON output. The tool reports that numbers and key order are preserved, and duplicate keys are kept and flagged. FormatBits describes json-format as a formatting check, not a schema check, so a successful result means the JSON is syntactically valid, not that it matches any particular API schema.
Output format can be compact or formatted, with indentation choices of 2 spaces, 4 spaces, or tab. Readers can select the style that matches their API request expectations and compare the formatted result against the original input before submission.
Because json-format performs client-side processing, pasted JSON does not need to be uploaded to a remote server for validation. Readers working with sensitive API payloads should still avoid pasting real credentials, secrets, or production data into any browser tool unless they have independently confirmed the site’s privacy behavior; this packet does not provide a privacy policy or data-handling guarantee.
A successful formatting pass indicates the JSON can be parsed, but it does not confirm that required fields are present, values have expected types, or property names match the API contract. For those checks, a separate schema validation step is needed after syntax validation passes.
When syntax checking is not enough
A syntax validator checks whether JSON text is well-formed: matching brackets and braces, quoted strings, valid commas, and correct escaping. FormatBits’ json-format is described as a formatting check rather than a schema check, so passing it means the JSON can be parsed, not that it matches the shape an API expects.
JSON Schema validation is the next layer. An external schema validation guide supports validating JSON documents against draft-07, 2019-09, and 2020-12 with precise error paths, and can generate draft-07 schemas from examples. Use this after a syntax check passes when the API requires specific fields, nested structures, allowed value ranges, or particular data types.
Validation errors expose instanceLocation for the JSON being validated and keywordLocation for the violated schema keyword. Required errors point to the parent object when the missing value does not exist, which helps distinguish between a missing property and an incorrectly typed value.
Syntax and schema validation solve different problems. Syntax errors such as a missing comma stop parsing entirely, while schema errors can occur in perfectly valid JSON, such as sending a string where an integer is expected or omitting a required property. Readers should treat syntax checking as the first gate and schema validation as the second gate before submitting payloads to an API.
Outcome logic matters when reviewing results: outcome is indeterminate when non-document-error messages exist, failure when error messages exist, and success otherwise. A document can parse successfully and still fail schema validation, so a clean syntax result should not be treated as final approval for an API call.
Practical questions to ask before choosing a validation layer include: Does the API publish a schema? Which draft version does it use? Are required fields documented separately from optional ones? If schema documentation is unavailable, confirm field names, types, and constraints with the API provider rather than assuming the structure from a sample response.
Reader questions:
- What exact JSON input should a reader paste into json-format before an API call?
- Which output fields in json-format indicate a syntax error versus a successful format pass?
- How does the tool report duplicate keys, and what should a reader do about them?
- When should JSON Schema validation be added after a syntax check passes?
- How can a reader use line, column, and extract information to correct a reported JSON error?
Reading validation messages and locating errors
When a JSON validation check runs, the result pane reports each problem through message objects inside a mandatory messages array. Every message object carries a mandatory type field, so readers can tell whether a result is a warning or a validation failure. Additional optional keys can include subtype, message, extract, offset, url, line, and column, giving varying levels of detail about what went wrong and where.
For precise source location, validators may report line, column, firstLine, firstColumn, lastLine, lastColumn, extract, and offset. Line and column numbers are one-based and counted using UTF-16 code units, so readers working with multibyte characters should treat column positions as byte-like offsets rather than visual character counts. The extract field can show a fragment of the surrounding source text, which helps identify unmatched brackets, missing commas, stray quotes, or invalid control characters without reopening the original file.
When a JSON Schema validator is involved, structural failures are identified with more than a line number. Error output distinguishes instanceLocation, which points to the part of the JSON document being validated, from keywordLocation, which identifies the violated schema keyword. For required-property errors, the location typically points to the parent object rather than to the missing value itself, because the missing value has no position in the document.
A reader can use these reports as follows: open the reported line in the source JSON, check the one-based column and extract around that position, confirm whether the problem is at the instance or at the schema keyword, then correct only that fragment. After editing, rerun the check to confirm that no remaining messages appear before sending the payload to the API.
Outcome labels help interpret the overall result: if non-document-error messages exist, the outcome is indeterminate; if error messages exist, it is failure; otherwise it is success. This means a single informational note should not be mistaken for a hard failure, while any genuine error message should block submission until fixed.
Because inputs are processed in the browser and the tool does not state that it saves user input, readers can test sensitive API payloads locally, though they should still avoid pasting credentials or secrets into any online form unless the tool’s privacy documentation explicitly confirms client-side-only handling.
Readers should verify current behavior directly on the FormatBits json-format page, because output fields and limits may change without this guide being updated.
Using URL encoding and timestamp tools alongside JSON work
URL encoding and timestamp conversion often matter just as much as the JSON body itself. A request can fail if a header, query parameter, or URL path contains characters that must be encoded, while a timestamp converted with the wrong unit can shift a call to the wrong instant or fall outside an API’s accepted range. FormatBits provides two browser tools for this related preparation work: url-codec and timestamp-convert. Understanding what each tool accepts and returns helps readers catch problems before they reach an API endpoint.
Inputs and output modes for url-codec
Readers choose either encode or decode, then choose whether the scope is one value or a whole URL. The distinction changes how the tool treats separators. For one value, reserved characters such as /, ?, &, and = are encoded. For a whole URL, structural separators such as ? and & are kept intact so the URL remains usable. The check runs when the reader presses Ctrl or Command plus Enter, and each check performs one operation. Because there is only one operation per check, readers must decide first whether they are encoding a fragment such as a filter value or an entire request URL.
Timestamp conversion inputs, units, and limits
Readers choose between Unix-to-date and date-to-Unix conversion, then select seconds or milliseconds as the input unit. For seconds, up to three decimal places are allowed, supporting fractional seconds. Milliseconds must be whole numbers. Negative timestamps are supported, which matters when representing dates before the Unix epoch. Choosing the wrong unit can produce a result that differs by a factor of one thousand, so readers should confirm which unit their API expects before submitting.
Where these tools fit with JSON validation
A JSON syntax check with json-format confirms that the document itself is well-formed, but it does not validate values inside strings such as URLs or timestamps. Running url-codec before building a JSON payload can prevent an API from receiving a malformed query parameter. Running timestamp-convert before inserting a date value can confirm that the format matches the API’s expected unit and precision. Together, these checks reduce the chance that a syntactically valid JSON document still breaks an API call because of a bad URL component or timestamp.
Safety and limits to verify
The source text does not state an input size limit or character limit for url-codec, nor a maximum timestamp range or numeric precision limit beyond what is described for seconds and milliseconds. Readers should check the tool page directly if they are working with very long URLs, unusually large timestamps, or sensitive values. Browser-based processing means input generally does not need to be uploaded to a server to perform the conversion, but readers should avoid pasting credentials, API keys, or other sensitive payload data into any tool unless they have independently confirmed how that data is handled.
Practical workflow for catching API-breaking JSON errors
Use the three enabled FormatBits tools as a repeatable pre-submission routine before sending JSON to an API. Start by opening json-format and pasting your JSON text into the editable source field, labeled JSON UTF-8, which accepts up to 256 KiB and starts at zero bytes until input is added. Press Ctrl or Command plus Enter to run the syntax check. In the result pane, choose compact or formatted output and set indentation to 2 spaces, 4 spaces, or a tab. Numbers and key order are preserved, duplicate keys are kept and flagged, and the result is described as a formatting check rather than a schema check. If syntax problems appear, review the reported line, column, extract, and offset details, correct the exact location in the source field, and rerun the check until formatting succeeds. Because processing is described as client-side and no saved input is mentioned, avoid pasting sensitive API payloads unless you understand and accept how the page handles data locally in your browser; when in doubt, test with non-sensitive example data first.
If your API call includes URL parameters, open url-codec, choose encode or decode, and select one value or a whole URL as the scope. Encoding one value covers reserved characters such as slash, question mark, ampersand, and equals sign; encoding a whole URL keeps separators such as question mark and ampersand intact. The check also runs with Ctrl or Command plus Enter, the result pane starts at zero bytes, and one operation is performed per check.
For timestamps in JSON payloads, open timestamp-convert, choose Unix to date or date to Unix, and select seconds or milliseconds as the input unit. Seconds allow up to three decimal places, milliseconds must be whole numbers, and negative timestamps are supported.
When syntax passes but you need structural assurance, add JSON Schema validation as a separate layer. External guidance supports draft-07, 2019-09, and 2020-12 validation with precise error paths, and can generate draft-07 schemas from examples. Validation errors expose instanceLocation for the JSON being validated and keywordLocation for the violated schema keyword; required errors point to the parent object when the value does not exist.
External validator output documentation defines success when no error messages exist, failure when error messages exist, and indeterminate when non-document-error messages exist. Message objects can include line, column, firstLine, firstColumn, lastLine, lastColumn, extract, and offset; line and column numbers are one-based and counted by UTF-16 code units. The root JSON object has a mandatory messages array and optional url, source, and language keys; each message object has a mandatory type and optional subtype, message, extract, offset, url, line, and column.
This workflow keeps the focus on catching syntax errors before they reach the API, while reminding readers to verify current tool behavior directly on FormatBits pages and treat unsupported capabilities as unknown rather than assumed.