API Mock JSON Response Generator

Describe the shape you want and get a JSON response body to point a client at, so front-end work can start before the real endpoint exists.

How to use

  1. Describe the fields and shape you want.
  2. A JSON response body is generated.
  3. Copy it into your mock server or fixture.

Frequently asked questions

Why mock a response at all?

So front-end work can start before the endpoint exists, and so tests have a fixed payload instead of depending on whatever the real service returns that day.

Is the generated data realistic?

It is shaped correctly with plausible values. It is not drawn from real records, which is the point: a fixture should never carry production data.

Can I get a list rather than one object?

Yes, ask for an array and the same shape is repeated with varying values, which is what you want for testing a table or a paginated view.

Where do I put the output?

Into a fixture file, a mock server such as json-server or MSW, or straight into a test as an inline constant.

Last updated

Powered by maratool