The example
The JSON above is the example. Explore it in the Tree tab, press Download to save it as a .json file, or Share to send someone a link to it. All names, ids, emails and values are invented.
Fields explained
| Path | Type | Notes |
|---|---|---|
orderId | string | A readable identifier. Strings avoid precision problems with long numbers. |
status | string | One of a small set of values such as pending, paid or shipped. |
items[].unitPriceCents | number | Price in the smallest currency unit, an integer. |
totals | object | Computed amounts, also in cents. totalCents = subtotal + shipping + tax. |
placedAt | string | ISO 8601 UTC timestamp. |
Read it in code
JavaScript:
const total = data.items.reduce((sum, i) => sum + i.quantity * i.unitPriceCents, 0); // 3290Python:
total = sum(i["quantity"] * i["unitPriceCents"] for i in data["items"]) # 3290What this example is good for
- Testing checkout, invoicing and reporting code
- Validating the structure with a JSON Schema
- Generating typed models for an orders service
Tips
- Use integers in the smallest unit (cents) or decimal strings for money, never binary floating point.
- Keep line items and totals consistent; recompute totals on the server instead of trusting the client.
Convert this example
Open it in a converter, then switch the output in the Code tab:
- JSON to TypeScript
- JSON to Zod
- JSON to Python (Pydantic)
- JSON to Go
- JSON to JSON Schema
- JSON to CSV
- JSON to YAML
- JSON to XML