shadcn.io is not affiliated with official shadcn/ui
JSON Validator File Upload Block for React
A JSON payload checker: paste text and see Valid or the line and column of the first error with the line shown, the key count, depth and size, a flattened tree of the parsed result, plus Prettify and Copy.
Installation
Overview
Find the one bad character in a payload before it ships, with this JSON validator panel for React with Base UI. It is Bracemark, API payload linting for a backend team. A monospaced Textarea starts with a payload that has one trailing comma; beside it, a result says "Invalid at line 4, column 43", shows that line with a caret under the column, and turns to a key count, a depth, a size in bytes and a flattened tree of the parsed result once the text is valid. A strict scanner at module scope, the same in every browser, finds the error. The one Shine Button prettifies valid text with two spaces and a Copy Button copies the payload. A File Upload strip lists a dropped .json file by name and size and says to paste its text. The panel is ruled by Guides, with a CSS entrance only. For API tooling, config editors and any form that takes JSON.
FAQ
Why not just call JSON.parse?
Browsers word its errors differently and some give no position at all. The scanner reads the text itself against the JSON grammar, so the message, line and column are the same everywhere. It reports the first problem only, such as a trailing comma, a single-quoted key or text after the value.
What is typed and what is worked out?
Only the starting payload is typed. The result, key count, depth, size and tree are all worked out from the text each time it changes, and the status line repeats the headline for screen readers.
What does Prettify do with invalid text?
Nothing to the text: the button stays pressable so the reason can be heard, and the status line says it cannot prettify and where the error is. Once the text is valid it is rewritten with two-space indents.
What stays local in this demo?
All of it. The text lives in the page, a dropped file is listed by name and size and never opened (paste its text instead), and nothing is uploaded or saved.