JSON 포매터 & 검증기
상세한 경로 수준 오류 메시지로 JSON 데이터를 JSON 스키마에 대해 검증합니다.
이 도구에 대해
왼쪽에 JSON 데이터를 붙여넣고 오른쪽에 JSON 스키마를 붙여넣은 후 검증을 클릭하여 적합성을 확인하세요. 내장된 순수 JS 검증기는 type, required, properties, 문자열 길이, 숫자 범위, 배열 크기 및 enum 제약 조건을 지원합니다. 오류는 전체 JSON 경로(예: $.user.age)로 보고되어 즉시 문제를 정확히 파악할 수 있습니다.
사용 방법
- 1 1단계: 왼쪽 패널에 JSON 데이터를 붙여넣거나 편집하세요(시작할 수 있도록 샘플이 미리 채워져 있습니다).
- 2 2단계: 오른쪽 패널에 JSON 스키마를 붙여넣거나 편집하여 예상 구조와 제약 조건을 정의하세요.
- 3 3단계: 검증 버튼을 클릭하여 검증을 실행하세요.
- 4 4단계: 결과를 검토하세요 — 녹색은 유효함을 의미하고, 빨간색은 JSON 경로와 명확한 메시지와 함께 각 오류를 표시합니다.
What a JSON Schema actually checks
JSON Schema is a vocabulary for describing the shape of JSON data: which keys must exist, what type each value should be, and what range of values is acceptable. Validation answers a single question — does this document conform to those rules? — and, when it does not, tells you precisely where it broke. This validator works on a practical subset of JSON Schema Draft-07 and reports every failure with a full JSON path such as $.user.age, so a problem buried three levels deep in a nested object is pinpointed rather than vaguely flagged.
The keywords it understands fall into a few groups:
| Applies to | Keyword | Meaning |
|---|---|---|
| Any value | type | Must be string, number, object, array, boolean, or null |
| Any value | enum | Must exactly match one of a fixed list of allowed values |
| Objects | required | Listed keys must be present |
| Objects | properties | Defines a sub-schema for each named key |
| Strings | minLength / maxLength | Character-count bounds |
| Numbers | minimum / maximum | Inclusive value bounds |
| Arrays | minItems / maxItems | Length bounds, with items validating each element |
A worked example
The tool starts with a schema requiring name, age, and email, where age is a number between 0 and 120 and role must be one of admin, user, or guest. Suppose you change the data so age is "thirty" and role is "superadmin", then drop the email field. Click Validate and you get three precise errors: $.age: expected number, got string, $.role: value must be one of ["admin", "user", "guest"], got "superadmin", and $: missing required property "email". Each line names the exact path and the exact violation, which turns debugging a malformed API payload from guesswork into a checklist.
One detail worth knowing: when a value fails its type check, the validator stops drilling into that branch — there is no point applying minimum to something that is not a number — so you see one clean type error rather than a cascade of confusing follow-ups.
How nesting and recursion work
Validation is recursive. When the schema describes an object via properties, the validator descends into each matching key and validates the value against its sub-schema, extending the path as it goes ($.user.address.zip). For arrays, an items sub-schema is applied to every element, with the index baked into the path ($.tags[2]). This means a single error message can point you straight to the third tag in a list inside a user object inside the root — no manual counting required.
Genuine use cases
- API contract testing. Capture a real response from an endpoint and validate it against the schema your front end expects. If the backend quietly changes a field type, you find out before your UI breaks.
- Config-file safety. Many tools accept JSON config. A schema lets you confirm a hand-edited config has all required keys and sane ranges before deploying it.
- Form and import validation. Before importing a batch of records, check each one conforms so you reject bad rows early with a clear reason.
- Learning JSON Schema. The two-pane live setup lets you tweak a schema rule and immediately see how the verdict changes, which is the fastest way to build intuition for keywords like
enumandrequired.
Common mistakes
- Confusing "absent" with "wrong type."
requiredonly fires when a key is missing. If a key is present butnull, you needtype(or to include"null"in an allowed type list) to catch it. - Expecting unlisted properties to be rejected. Extra keys not named in
propertiesare simply ignored here — they do not cause an error. Plan your schema knowing that unknown fields pass through. - Off-by-one on bounds.
minimumandmaximumare inclusive, andminLengthcounts characters, not bytes — a multi-byte emoji may count differently than you expect. - Invalid JSON in either pane. If the data or the schema itself is not parseable JSON, you get a parse error first; fix the syntax before the structural rules can even run.
How this differs from formatting your JSON
Pretty-printing or linting JSON only confirms the syntax is valid — that brackets and quotes are balanced. Schema validation goes a layer up: it confirms the semantics, that the right fields exist with the right types and values. A document can be perfectly formatted and still wildly wrong for your application; that gap is exactly what this tool closes. Everything runs locally in your browser, so your data and schema never leave your device — safe for proprietary payloads and internal API contracts.