4.2: Generating Seed Data
Last updated
Last updated
We need some Users to begin adding more features.
We could manually register users, enter their profile information, find photos for them, etc.
But, we're programmers. We're lazy.
We can do it with less effort.
One option for generating seed data is . It's the method we'll be using.
There are many other options like the or . Feel free to experiment with those as well.
Navigate to and have a look around the site.
Click the 'Help' button and see a list of options we can use to generate data. It has a lot - generating integers, strings, bools, etc. as well as more interesting data generation like lorem ipsum, companies, emails, phone numbers, etc. You can also write custom functions to generate data - which is what we'll do for photos.
We need to generate two sets of data - for males and females (so their names and photos align). And we'll generate 25 of each and then combine them into a single .json file
Ladies first:
Now, change out 'female' to 'male' in the Username value and change 'women' to 'men' in the api call and run it again:
Now, combine the two JSON results into a single file.
Save it in your .Data
project as UserSeedData.json.
Alternatively, you can use the JSON data provided .
If you want to verify you combine the two correctly, use a JSON validator .