Skip to content

Instantly share code, notes, and snippets.

@nic0-lab
Last active July 3, 2017 08:22
Show Gist options
  • Save nic0-lab/ff1f9d3afaa4aaa2b24319f86a7d721b to your computer and use it in GitHub Desktop.
Save nic0-lab/ff1f9d3afaa4aaa2b24319f86a7d721b to your computer and use it in GitHub Desktop.
JSON Generator Pattern
[
'{{repeat(5, 5)}}',
{
friends: [
'{{repeat(10)}}',
{
id: '{{index()}}',
name: '{{firstName()}} {{surname()}}'
}
]
}
]
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
{
cars: [
'{{repeat(10)}}',
{
id: '{{index()}}',
product: '{{company()}}',
price: '{{integer(500, 50000)}}' + '$'
}
]
}
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
{
cars: [
'{{repeat(10)}}',
{
'id': '{{index()}}',
'product': '{{lorem(1, "words")}}',
'company': '{{company()}}',
'color': '{{random("noir", "gris", "blanc", "rouge", "bleu")}}',
'price': '{{integer(500, 50000)}}' + '$'
}
]
}
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
[
{
name: 'USB Stick',
options: [
'{{repeat(5, 10)}}',
{
'id': '{{index()}}',
'details': '{{random("1GB", "2GB", "4GB", "8GB", "16GB")}}',
'price': '{{integer(5, 100)}}' + '$'
}]
},
{
name: 'USB Plug',
options: [
'{{repeat(5, 10)}}',
{
'id': '{{index()}}',
'details': '{{integer(1, 10)}}' + 'ft cable',
'price': '{{integer(5, 50)}}' + '$'
}]
},
{
name: 'Small Phone',
options: [
'{{repeat(5, 10)}}',
{
'id': '{{index()}}',
'details': '{{random("Nokia", "Iphone", "Samsung", "HTC", "Xiaomi")}}' + ' Phone',
'price': '{{integer(100, 700)}}' + '$'
}]
},
{
name: 'Camera',
options: [
'{{repeat(5, 10)}}',
{
'id': '{{index()}}',
'details': '{{random("Blue", "Red", "Yellow", "Purple", "Black")}}' + ' Camera',
'price': '{{integer(50, 1000)}}' + '$'
}]
}
]
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment