Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alfathmuqoddas/generate-random-data

Shell Script for generating random json and sql data
https://github.com/alfathmuqoddas/generate-random-data

Last synced: about 6 hours ago
JSON representation

Shell Script for generating random json and sql data

Awesome Lists containing this project

README

        

# Shell Script for generating random json and sql

## Make the script executable
1. ```chmod +x generate_random_json_array.sh```
2. ```chmod +x generate_random_sql.sh```

## Usage
1. ```$ ./generate_random_json_array.sh ```
2. ```$ ./generate_random_sql.sh ```

## Sample Output
1. JSON ```$ ./generate_random_json_array.sh 3```
```
[
{
"id": 1,
"name": "William",
"age": 43,
"email": "[email protected]",
"address": {
"city": "Seattle",
"country": "USA"
},
"interests": "cooking"
},
{
"id": 2,
"name": "John",
"age": 27,
"email": "[email protected]",
"address": {
"city": "Los Angeles",
"country": "USA"
},
"interests": "traveling"
},
{
"id": 3,
"name": "Olivia",
"age": 37,
"email": "[email protected]",
"address": {
"city": "Boston",
"country": "USA"
},
"interests": "reading"
}
]
```

2. SQL `$ ./generate_random_sql.sh 3`
```
INSERT INTO your_table (name, age, email, city, country, interests) VALUES ('John', 39, '[email protected]', 'Los Angeles', 'USA', 'traveling');
INSERT INTO your_table (name, age, email, city, country, interests) VALUES ('Bob', 57, '[email protected]', 'Los Angeles', 'USA', 'painting');
INSERT INTO your_table (name, age, email, city, country, interests) VALUES ('John', 55, '[email protected]', 'New York', 'USA', 'sports');
```