Synthetic JSON arrays for mocks and fixtures
REST list endpoints and frontend tables often expect a JSON array of objects—each key typed as string, number, boolean, or null. Synthetic generators sample from plausible patterns (names, emails, UUIDs) so Postman examples and unit tests look realistic without copying production PII.
After generation, pretty-print with JSON formatter, validate shape with JSON Schema validator, export tables via JSON to CSV or CSV generator with the same column picker. Standalone ids: UUID generator.
Mock data and JSON typing
JSON arrays as API list payloads
- A top-level `[...]` wraps zero or more objects; HTTP 200 list responses commonly use this shape.
- Each object is an unordered set of keys—column order in pretty-print is cosmetic, not schema order.
- Numbers and booleans must stay unquoted in JSON; quoted digits become strings and fail strict type checks.
- null represents absent optional fields—distinct from empty string "" or omitted keys.
Synthetic vs production data ethics
- Fixtures should avoid real emails, phone numbers, or government IDs—even “random” leaks can collide with real people.
- UUID v4 and incrementing id fields identify rows in mocks without referencing live databases.
- Regenerating rows changes values—tests should assert schema and types, not fixed literals, unless seeded.
- OpenAPI examples marked `example` or `examples` are documentation-only—not executed code.
Field types commonly mocked together
- Profile bundles: name + email + active flag mimic directory or CRM list items.
- Location bundles: city + country support geo filters without full address validation.
- Timestamps as ISO-8601 strings serialize consistently in JSON and parse in most runtimes.
- url and company strings stress UI overflow and link rendering more than numeric edge cases.
From mock JSON to CSV and back
- Arrays of flat objects map cleanly to CSV—one row per object, headers from union of keys.
- Nested objects do not round-trip through CSV without flattening; keep mocks flat for spreadsheet export.
- CSV adds no types—re-import may coerce strings; JSON preserves boolean and number literals.
- Same column set can be emitted as JSON array or CSV header row for parallel API and ETL tests.
When random JSON helps
OpenAPI and Postman examples
Fill list-endpoint samples before the backend exists, then tighten with schema validation.
Frontend tables and Storybook
Feed datagrid stories with varied row counts; switch to JSON to CSV for spreadsheet QA.