⇄ Code & API Conversion

Mock API Generator

Generate realistic fake JSON data from a JSON Schema, OpenAPI 3.x spec, or a sample JSON object shape.

Updated

JSON Schema OpenAPI 3.x Smart field names No signup

Loading Mock API…

What this page sends

  • Your input: Processed in this tab and not sent to a server.
  • Share links: Share links put a Base64 copy of your input and output in the URL itself (after #d=). Anyone with the link can read it, so don't share a link that contains secrets.
  • Editor: On desktop screens the code editor (Monaco) is downloaded from cdn.jsdelivr.net; phones get a built-in lightweight editor instead.
  • Page load: Loading the page requests HTML, scripts and images from ByteKiln, fonts from Google Fonts, and sends Google Analytics page views, tool-usage events and catalog interactions (tool/category IDs, result status and whether a click followed search — never your input, output or search terms). Privacy & sharing

How the Mock API Generator Works

The ByteKiln Mock API Generator parses JSON Schema or OpenAPI specs in-browser and generates realistic fake data using a lightweight built-in data generator with no external faker dependency.

Schema walking

The tool recursively walks the JSON Schema, handling type, properties, items, enum, anyOf, oneOf, allOf, const, and format keywords. Each leaf node generates a typed fake value.

Smart string generation

String fields without a format annotation are classified by field name. Names containing "email", "url", "id", "name", "phone", "date", "status", "color", or "slug" each produce contextually appropriate fake values.

OpenAPI parsing

For OpenAPI specs, the tool iterates all paths and HTTP methods, finds the 2xx response schema, resolves any $ref pointers, and generates mock data for each endpoint.

Limitations

  • Generated values are random-looking fakes from a small built-in generator; they respect types, enums and formats but not your business rules, uniqueness or relationships between records.
  • In JSON Schema input, $ref is not resolved (it appears as a placeholder); OpenAPI specs resolve local #/components references only — no external or remote $ref.
  • Keywords such as pattern, minLength, maxLength and multipleOf are not applied, so validate the output against your schema if your tests depend on them.
  • Each run uses a new seed, so the data isn't reproducible between visits.

FAQ

Short answers for the things developers usually ask before trusting a tool.

What input formats are supported?

Three input modes are supported: a sample JSON object (the shape is inferred), a JSON Schema (Draft 7 compatible), and an OpenAPI 3.x spec (JSON format). The tool auto-detects which mode to use.

How is the fake data generated?

The generator uses a seeded pseudo-random number generator. String values are generated based on the field name — a field named "email" produces an email address, "createdAt" produces an ISO timestamp, and "id" produces a UUID.

Does it support nested objects and arrays?

Yes. The schema walker handles object types with nested properties, array types with items schemas, anyOf/oneOf/allOf combiners, and enum values. Recursion is limited to a depth of 6 to prevent infinite loops.

Are $ref schemas resolved?

Same-document $ref references (e.g. #/components/schemas/User in an OpenAPI spec) are resolved by traversing the JSON path. External file references are not supported.

Can I use this to generate test fixtures?

Yes. Download the JSON output and use it directly as fixture data in Jest, Vitest, Playwright, or any testing framework. Set the record count to the number of test cases you need.

Related tools

Useful follow-ups when one conversion usually turns into three more.