Faker , Random Data Creation - torarnehave1/slowyouio GitHub Wiki

I used the https://mockaroo.com/ it works perfectly and I can generate 1000 row of data for free.

To create 100 rows of random test data based on the given schema for persons, we can generate JSON data with the following fields: name, givenname, familyname, email, phone, and organization. Each of these fields will be filled with appropriate dummy data.

Here's a Python script that you can run locally to generate this JSON file:

import json
import random
from faker import Faker

fake = Faker()

def create_person():
    return {
        "name": fake.name(),
        "givenname": fake.first_name(),
        "familyname": fake.last_name(),
        "email": fake.email(),
        "phone": fake.random_number(digits=10),
        "organization": fake.company()
    }

data = [create_person() for _ in range(100)]

with open('persons_data.json', 'w') as f:
    json.dump(data, f, indent=4)

print("JSON file with 100 rows of random data created successfully.")

Instructions to Run the Script

  1. Install Python: Ensure you have Python installed on your computer.
  2. Install Faker: Faker is a Python package used to generate fake data. Install it via pip:
    pip install faker
    
  3. Save the script: Copy the above Python script and save it into a file, say generate_data.py.
  4. Run the script: Open your terminal or command prompt, navigate to the directory containing the script, and run:
    python generate_data.py
    
    This will create a file named persons_data.json in the same directory with 100 rows of random data.

This script uses the Faker library to generate realistic names, emails, and company names. You can customize the script further if you have specific requirements for any of the fields.