Generate Random JSON data

Rahul Kumar
2 min readMar 14, 2021

--

URL: https://www.json-generator.com/

[
‘{{repeat(5, 7)}}’,
{
_id: ‘{{objectId()}}’,
personId: ‘{{index()}}’,
guid: ‘{{guid()}}’,
isActive: ‘{{bool()}}’,
balance: ‘{{floating(1000, 4000, 2, “$0,0.00”)}}’,
picture: ‘http://placehold.it/32x32',
age: ‘{{random(“belowEighteen”, “eighteenToThirtyFive”, “aboveFiftySix”, “thirtyFiveToFiftySix”)}}’,
cameraId: ‘{{random(“EntryCam”, “ExitCam”)}}’,
store: ‘{{random(“Store 1”, “Store 2”)}}’,
gender: ‘{{random(“Male”, “Female”)}}’,
objectName: ‘processed/EntryCam/1615007553000.jpeg’,
solutionSlug: ‘syg-demographics’,
predictionData: ‘[{\”person_id\”: 1, \”age\”: null, \”gender\”: null, \”loc_x\”: 465, \”loc_y\”: 291, \”box\”: [428, 165, 502, 418]}, {\”person_id\”: 7, \”age\”: \”Minor\”, \”gender\”: \”Female\”, \”loc_x\”: 81, \”loc_y\”: 388, \”box\”: [37, 161, 125, 615]}, {\”person_id\”: 9, \”age\”: \”Adult\”, \”gender\”: \”Female\”, \”loc_x\”: 154, \”loc_y\”: 579, \”box\”: [75, 440, 233, 719]}, {\”person_id\”: 10, \”age\”: \”Minor\”, \”gender\”: \”Male\”, \”loc_x\”: 386, \”loc_y\”: 361, \”box\”: [340, 161, 433, 561]}, {\”person_id\”: 11, \”age\”: \”Adult\”, \”gender\”: \”Female\”, \”loc_x\”: 366, \”loc_y\”: 195, \”box\”: [309, 16, 423, 374]}, {\”person_id\”: 15, \”age\”: null, \”gender\”: null, \”loc_x\”: 593, \”loc_y\”: 152, \”box\”: [547, 0, 640, 304]}]’,

age: function (tags) {
var ageGroups = [‘belowEighteen’, ‘eighteenToThirtyFive’, ‘aboveFiftySix’, ‘thirtyFiveToFiftySix’];
return ageGroups[tags.integer(0, ageGroups.length — 1)];
},
cameraId: function (tags) {
var cameras = [‘EntryCam’, ‘ExitCam’];
return cameras[tags.integer(0, cameras.length — 1)];
},
store: function (tags) {
var stores = [‘Store 1’, ‘Store 2’];
return stores[tags.integer(0, stores.length — 1)];
},
gender: function (tags) {
var gender = [‘Male’, ‘Female’];
return gender[tags.integer(0, gender.length — 1)];
}
}
]

# DEMOGRAPHICS:

[
'{{repeat(1, 100)}}',
{
_id: '{{objectId()}}',
personId: '{{index()}}',
age: '{{random("belowEighteen", "eighteenToThirtyFive", "aboveFiftySix", "thirtyFiveToFiftySix")}}',
cameraId: '{{random("EntryCam", "ExitCam")}}',
store: '{{random("Store 1", "Store 2")}}',
gender: '{{random("Male", "Female")}}',
timestamp: '{{date(new Date(2021,2,14), new Date(2021,2,15)).getTime()}}',
objectName: 'processed/EntryCam/1615007553000.jpeg',
solutionSlug: 'syg-demographics',
predictionData: '[{\"person_id\": 1, \"age\": null, \"gender\": null, \"loc_x\": 465, \"loc_y\": 291, \"box\": [428, 165, 502, 418]}, {\"person_id\": 7, \"age\": \"Minor\", \"gender\": \"Female\", \"loc_x\": 81, \"loc_y\": 388, \"box\": [37, 161, 125, 615]}, {\"person_id\": 9, \"age\": \"Adult\", \"gender\": \"Female\", \"loc_x\": 154, \"loc_y\": 579, \"box\": [75, 440, 233, 719]}, {\"person_id\": 10, \"age\": \"Minor\", \"gender\": \"Male\", \"loc_x\": 386, \"loc_y\": 361, \"box\": [340, 161, 433, 561]}, {\"person_id\": 11, \"age\": \"Adult\", \"gender\": \"Female\", \"loc_x\": 366, \"loc_y\": 195, \"box\": [309, 16, 423, 374]}, {\"person_id\": 15, \"age\": null, \"gender\": null, \"loc_x\": 593, \"loc_y\": 152, \"box\": [547, 0, 640, 304]}]'

}
]

--

--

Rahul Kumar
Rahul Kumar

No responses yet