Fake JSON generator

I came across a situation where I wanted to test enter a bunch of fake users in my user-management system. I didn’t want to have to come up with a dozen or so fake names/usernames/passwords/addresses/emails/phone numbers so I came across this in my travels: http://www.json-generator.com/

It’s pretty glorious and will come up with some great formatted output like so:

[
  {
    "_id": "54669e8eeed05ad0561d30d0",
    "index": 0,
    "guid": "3bb924c2-995f-476f-863f-9a62033d1f3b",
    "isActive": true,
    "balance": "$2,907.88",
    "picture": "http://placehold.it/32x32",
    "age": 27,
    "eyeColor": "blue",
    "name": {
      "first": "Lilian",
      "last": "Pace"
    },
    "company": "FURNITECH",
    "email": "lilian.pace@furnitech.ca",
    "phone": "+1 (862) 598-2996",
    "address": "978 Ferry Place, Cuylerville, South Dakota, 5940",
    "favoriteFruit": "banana"
  },
  {
    "_id": "54669e8e0d970b7fe16048f9",
    "index": 1,
    "guid": "f399dd7a-9dec-41d1-b0e2-3a0a01b35555",
    "isActive": true,
    "balance": "$1,486.03",
    "picture": "http://placehold.it/32x32",
    "age": 38,
    "eyeColor": "brown",
    "name": {
      "first": "Newton",
      "last": "Oneill"
    },
    "company": "ZYPLE",
    "email": "newton.oneill@zyple.com",
    "phone": "+1 (839) 580-2988",
    "address": "180 Harman Street, Manchester, Oklahoma, 5221",
    "favoriteFruit": "banana"
  },
  {
    "_id": "54669e8e6140397e656db5d9",
    "index": 2,
    "guid": "6c818c1d-3a97-49a0-89bf-7a2ec1c4a746",
    "isActive": true,
    "balance": "$1,079.89",
    "picture": "http://placehold.it/32x32",
    "age": 36,
    "eyeColor": "blue",
    "name": {
      "first": "Sofia",
      "last": "Manning"
    },
    "company": "ACUMENTOR",
    "email": "sofia.manning@acumentor.info",
    "phone": "+1 (921) 570-3737",
    "address": "861 Calyer Street, Southview, Delaware, 9587",
    "favoriteFruit": "apple"
  },
  {
    "_id": "54669e8e5174de90cf0bd74b",
    "index": 3,
    "guid": "c58d8e45-5a00-4369-b7f3-bbcee65085e0",
    "isActive": false,
    "balance": "$2,312.17",
    "picture": "http://placehold.it/32x32",
    "age": 25,
    "eyeColor": "brown",
    "name": {
      "first": "Sonja",
      "last": "Banks"
    },
    "company": "MICRONAUT",
    "email": "sonja.banks@micronaut.io",
    "phone": "+1 (983) 427-3432",
    "address": "829 Ainslie Street, Forbestown, Hawaii, 171",
    "favoriteFruit": "banana"
  },
  {
    "_id": "54669e8efc123c78cd4e235d",
    "index": 4,
    "guid": "c36aeb58-5b71-43c1-b0b6-87dd0e251e19",
    "isActive": true,
    "balance": "$2,385.42",
    "picture": "http://placehold.it/32x32",
    "age": 21,
    "eyeColor": "green",
    "name": {
      "first": "Ruth",
      "last": "Barry"
    },
    "company": "QUOTEZART",
    "email": "ruth.barry@quotezart.biz",
    "phone": "+1 (896) 527-2764",
    "address": "915 Village Court, Wanamie, California, 2277",
    "favoriteFruit": "strawberry"
  },
  {
    "_id": "54669e8e20d7b382986e86f5",
    "index": 5,
    "guid": "3a2efd1b-fadb-476f-bc71-7699c34ea7a9",
    "isActive": false,
    "balance": "$3,487.29",
    "picture": "http://placehold.it/32x32",
    "age": 24,
    "eyeColor": "blue",
    "name": {
      "first": "Jacobs",
      "last": "Downs"
    },
    "company": "KOZGENE",
    "email": "jacobs.downs@kozgene.me",
    "phone": "+1 (884) 550-3072",
    "address": "873 Prospect Street, Foscoe, Pennsylvania, 6154",
    "favoriteFruit": "banana"
  }
]

 

I used this recipe:

[
  '{{repeat(5, 7)}}',
  {
    _id: '{{objectId()}}',
    index: '{{index()}}',
    guid: '{{guid()}}',
    isActive: '{{bool()}}',
    balance: '{{floating(1000, 4000, 2, "$0,0.00")}}',
    picture: 'http://placehold.it/32x32',
    age: '{{integer(20, 40)}}',
    eyeColor: '{{random("blue", "brown", "green")}}',
    name: {
      first: '{{firstName()}}',
      last: '{{surname()}}'
    },
    company: '{{company().toUpperCase()}}',
    email: function (tags) {
      // Email tag is deprecated, because now you can produce an email as simple as this:
      return (this.name.first + '.' + this.name.last + '@' + this.company + tags.domainZone()).toLowerCase();
    },
    phone: '+1 {{phone()}}',
    address: '{{integer(100, 999)}} {{street()}}, {{city()}}, {{state()}}, {{integer(100, 10000)}}',
    favoriteFruit: function (tags) {
      var fruits = ['apple', 'banana', 'strawberry'];
      return fruits[tags.integer(0, fruits.length - 1)];
    }
  }
]

Pretty neat eh? You can spit it out to JSON text files and have at them! Working smarter and not harder strikes again!