Using Random JSON Data Generators like Mockaroo

A lot of times you need some fake data to help visualize how things will work. For example, you might need a list of usernames along with the user's first/last name to help see how the interface looks. You can only populate so many "Jane Doe" before it looks too much like the other.

You could build your own generator but why reinvent the wheel when someone else has already. Enter mockaroo, I came across this site while looking for ways to randomly generate user records. I needed not only random data but my data had sub arrays and objects within each record and those arrays and objects were also random (i.e. not every record had the same amount of items in their arrays, etc).

Often, the interface can race ahead of the back-end API or sometimes you don't want to hook into the back-end API for development and testing. So having sample data is great for both of those points.

Mockaroo isn't the only random data generator, but it's the one that I feel gets you the sample data the quickest and gives you a lot of nice output options including JSON, CSV, SQL and excel. This means you can set what type of random data you want and then import that directly into your app via most of the major mechanisms. The only down side is that you can't connect to the data via a GET request because they haven't enabled CORS.

The other part I like about mockaroo is the data types. Instead of being all strings and numbers they have a really nice set of built-in data types like random first and last names, fake email addresses, mailing addresses, domain names, etc. and of course arrays and other things.

Daniel Tse

Read more posts by this author.

Subscribe to Daniel Tse, Engineer, Consultant

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!