Skip to content Skip to sidebar Skip to footer

Random Json Object Generator

I need a tool which generates random JSON objects. I want to use this tool to do testing on my HTTP POST requests and use the random JSON object in it. Any suggestions?

Solution 1:

Check out this service: http://json-generator.appspot.com/ It supports several functions:

  • int $incr (increment, starting from 1)
  • int $randInt(a,b) (random integer from a to b)
  • boolean $bool (random true/false)
  • string $firstName/$lastName (random (1 of 100) russian name/surname)
  • string $company (random company name 1 of 100)
  • string $phone (random russian phone number)
  • string $email (random email, generated base on $name and $company)
  • string $date (random data)
  • $repeat:n repeats object n times in array

original post in russian: http://habrahabr.ru/blogs/javascript/132286/

Solution 2:

You might want to look at mockJSON, whose approach is similiar to the appspot json-generator but is open source.

Here are the keywords it supports.

  • @NUMBER
  • @LETTER_UPPER
  • @LETTER_LOWER
  • @MALE_FIRST_NAME
  • @FEMALE_FIRST_NAME
  • @LAST_NAME
  • @EMAIL
  • @DATE_YYYY
  • @DATE_DD
  • @DATE_MM
  • @TIME_HH
  • @TIME_MM
  • @TIME_SS
  • @LOREM
  • @LOREM_IPSUM

If you wanted to use templating with Python you might want to look into the port I created at https://github.com/JamesMcMahon/mockjson.py.

Solution 3:

i would recommend just building a script in PHP...its really easy to convert arrays to json, so you could just make a randomized array and do: echo json_encode($array);

Solution 4:

Try this awesome tool: Json Generator. You need nothing more.

Solution 5:

I made a tool based on mockJSON that lets you POST requests to get the templated JSON, instead of using a local plugin. You can check it out here.

Post a Comment for "Random Json Object Generator"