Custom Data

Overview

Mockend can pick random values that you provide. This lets you control the data served and match your specific domain.

Example

.mockend.json
{
  "category": {
    "string": ["One", "Two"]
  },
  "code": {
    "int": [100, 200, 300]
  }
}

External generator

In addition to this, Mockend works really well with external libraries to generate common values for your .mockend.json. Here's a JavaScript example using FakerJS (opens in a new tab):

const randomNames = []
 
// Create an array of 100 random names
for (let i = 0; i < 100; i++) {
  randomNames.push(fake.name.firstName())
})
 
JSON.stringify({
  User: {
    // Mockend will use firstNames provided by FakerJS
    name: { string: randomNames }
  }
})

Other libraries:

Last updated on January 16, 2023