开发者

Random JSON object generator [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 2 years ago.

Improve this question 开发者_如何学Python

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?


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/


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.


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);


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜