portfolios.tools

API Mock Data Generator

Generate type preserving JSON mock rows from an object template or matching object examples.

JSON template and row count

Enter a JSON object template or matching object examples.

Generated mock rows

Enter a JSON object template or matching object examples.

How it works

Paste one JSON object or an array of matching object examples. Enter the number of mock rows to create. The generator treats the input as a value template, not as JSON Schema.

For a root array, every entry must be an object with the same recursive keys and JSON types. The first object is the template. Values in later objects are checked for shape but are not combined into field hints.

The generator creates each row recursively. Compatible field name hints can provide UUID strings, sample emails and names, recent date strings, account codes, ticker symbols, or numeric examples. Null values and array contents remain unchanged.

Review the result before using it as a test fixture. Add API specific constraints and validate it with the system that will consume the mock data.

Step by step

  1. Paste a JSON object template
  2. Choose a whole row count from 1 to 1,000
  3. Review the generated JSON rows

Tested example

For a repeatable example, use template {"id":1,"valid":true,"amount":100.5,"eventDate":"2024-01-01","contact":{"email":"old"},"meta":null,"items":[{"id":2},null,[true]]}, row count 1, a random source that returns 0 each time, and clock 2026-10-18T00:00:00Z.

The generated row is [{"id":100000,"valid":false,"amount":10,"eventDate":"2026-10-18","contact":{"email":"james@example.com"},"meta":null,"items":[{"id":2},null,[true]]}]. The number, boolean, null, object, and array types remain intact. The email and date string values use compatible name hints.

When to use this tool

Use the generator to create placeholder JSON rows from an example object when building or testing an interface that needs sample data.

It is suited to mock fixtures that follow a known object shape. It does not create a financial forecast, validate a service contract, or generate data from an API schema.

Common mistakes

Do not paste JSON Schema or assume the field name determines the JSON type. The template value controls the generated type, while compatible names can guide its sample value.

Do not expect array contents to be randomized or later objects in a root array to supply new fields. Use matching object examples and review the generated JSON against your intended test fixture.

Generation rules

For each object property, generate a value compatible with the sample JSON type.

Apply a field name hint only when it preserves that type.

Copy arrays as fixtures and recursively generate nested objects.

This is a template based generator. It does not validate generated rows against an API contract or guarantee realistic domain data.

Limitations and assumptions

Name hints are simple field name tokens, not schema validation. Arrays remain literal fixtures, so their contents repeat in every row. Root arrays must be nonempty and contain objects with the same recursive key and type shape. Input is limited to 100,000 characters, 10,000 JSON values, and 40 levels of nesting. Generated output is limited to 50,000 JSON values across all rows. Generated strings, dates, identifiers, and numbers are synthetic examples only.

Key terms

JSON template
A JSON template is an example object whose keys and value types guide the shape of generated mock rows.
Field name hint
A field name hint is a simple name token, such as email or ticker, used to choose a sample value without changing the template value type.
Fixture array
A fixture array is copied from the template into each row without changing its elements.

Related tools

CSV to Financial JSON converts supported CSV input to JSON. SQL to TypeScript turns SQL table definitions into TypeScript declarations. This tool creates mock rows from JSON object examples.

JSON to OpenAPI infers a response schema from JSON examples. This tool starts with a JSON template and generates sample rows; it does not read JSON Schema or OpenAPI definitions.

FAQ

What input does this tool accept?

Enter either one JSON object or a nonempty array of JSON objects with the same recursive key and type shape. For an array, the first object supplies the template after all entries pass the shape check. A single object is repeated to make the requested number of rows.

Do generated values keep their JSON types?

The generator keeps the JSON primitive type. Null stays null, booleans stay booleans, numbers stay numbers, and strings stay strings. A name hint only changes values in a compatible type, so a numeric id remains numeric and a boolean field called valid remains boolean.

How are nested objects and arrays handled?

Nested objects are generated recursively. Arrays are treated as literal fixtures: their contents are copied without generating new values, and each output row receives its own deep copy. This keeps mixed arrays and nested arrays in the supplied shape.

How many rows can I generate?

Choose a whole number from 1 through 1,000. Fractions, blank values, and numbers outside that range show an error instead of being rounded or clamped.

What do the field name hints mean?

Hints use field name tokens such as id, email, name, date, amount, account, and ticker. They supply sample shaped values only when compatible with the JSON type. The values are synthetic examples, not market data, a financial dataset, or proof that an API accepts them.

Related tools

CSV to Financial JSON converts supported CSV input to JSON. SQL to TypeScript turns table definitions into TypeScript declarations. JSON to OpenAPI infers response schemas from JSON examples. This tool generates mock rows from JSON object templates.