FHIR JSON Prettifier with Syntax Highlighting
Format and beautify FHIR JSON with syntax highlighting. Free, instant, fully client-side prettifier.
- Format and beautify messy FHIR JSON with syntax highlighting.
- Detects malformed JSON and points to the offending line.
How to use the JSON Prettifier
- Paste JSON (minified, badly indented, or copied from a log) or drop a
.jsonfile. - Click Prettify to format it with 2-space indentation, syntax highlighting and line numbers. Click Minify to collapse it to a single line.
- Copy or download the result.
If the input isn't valid JSON, you'll see the parser's error message so you can find and fix the problem. Everything runs in your browser.
When you need it
- Reading API responses and logs. Servers and log aggregators often emit FHIR on one line. Formatting it is the first step in finding anything.
- Finding syntax errors. A trailing comma, a missing quote or a stray
}from hand-editing makes a whole payload unparseable. The error message tells you what went wrong and where. - Consistent diffs. Formatting two versions of a resource the same way before comparing them avoids noise from whitespace. (For a structural comparison, use Resource Diff.)
- Minifying for transport. Single-line JSON is handy for NDJSON files, environment variables, test fixtures and
curl -dpayloads.
Worked example
Input:
{"resourceType":"Patient","id":"example","name":[{"family":"Shaw","given":["Amy"]}],"gender":"female",}
This fails to parse: there's a trailing comma before the final }, which JSON doesn't allow (JavaScript does, which is why it slips in). Remove it and Prettify gives:
{
"resourceType": "Patient",
"id": "example",
"name": [
{
"family": "Shaw",
"given": ["Amy"]
}
],
"gender": "female"
}
The JSON mistakes that break FHIR payloads
| Mistake | Example | Fix |
|---|---|---|
| Trailing comma | "gender": "female",} | Remove the last comma |
| Single quotes | {'resourceType': 'Patient'} | JSON requires double quotes |
| Unquoted keys | {resourceType: "Patient"} | Quote every key |
| Comments | // test patient | JSON has no comments; remove them |
| Smart quotes from documents | “Patient” | Replace with straight quotes " |
NaN, undefined | "value": NaN | Use a number or omit the element |
Limitations
- The prettifier checks JSON syntax only. Well-formed JSON can still be invalid FHIR (wrong element names, wrong types, missing required elements). Run the FHIR Validator for that.
- Key order is preserved as written. It doesn't reorder elements into the specification's order.
- XML isn't supported.
FAQ
Does it change my data?
Prettify and Minify only change whitespace. Keys, values and order stay exactly the same. One caveat comes from JSON parsing itself: very large integers beyond JavaScript's safe range (more than 15–16 digits) can lose precision. Keep such identifiers as strings, which FHIR requires for id and identifier values anyway.
Is my JSON uploaded?
No. Formatting uses the browser's built-in JSON parser, and nothing leaves this page.
Which FHIR versions does it support?
All of them, and any other JSON. It only checks JSON syntax, not FHIR rules.
Can it format FHIR XML?
No. It handles JSON only.
FHIR Toolbox is a free collection of HL7 FHIR tools by Omindra Labs. The tools process your data in your browser; it is not uploaded for normal tool operations.