An optional field
gift_note appears in one item, so it becomes GiftNote string `json:"gift_note,omitempty"`.
{"items": [{"sku": "A"}, {"sku": "B", "gift_note": "hi"}]}Paste a JSON sample. Go structs with json tags are written beside it.
Structs come from one sample. Add a package line, and check that numbers typed int64 never arrive with a fraction.
Ctrl+Enter or ⌘+Enter runs this tool immediately.
Waiting for input.
Parsing stays in this browser. Input is not uploaded or saved.
gift_note appears in one item, so it becomes GiftNote string `json:"gift_note,omitempty"`.
{"items": [{"sku": "A"}, {"sku": "B", "gift_note": "hi"}]}The array becomes type Root []RootItem, and each item becomes a RootItem struct.
[{"id": 1}, {"id": 2}]Generate TypeScript interfaces from a JSON sample in the browser. Array items are merged, and keys missing from some items become optional.
Generate a draft 2020-12 JSON Schema from a JSON sample in the browser. Types, nested objects, array items, and required keys are inferred.
Validate JSON, then pretty-print it with 2 or 4 spaces or minify it. Invalid JSON produces an error and leaves the output empty.