简体   繁体   English

在 json 文件中生成随机数

[英]Generating random number inside json file

I want to give a random number in json file which is payload for the API post request.我想在 json 文件中给出一个随机数,它是 API 发布请求的有效负载。 The "ssn" value in json file should be unique everytime. json 文件中的“ssn”值每次都应该是唯一的。 How do we do that?我们该怎么做?

"ssn": "Math.ceil(Math.random() * 1000000000)",

This doesn't work as it take the function as a value.这不起作用,因为它将 function 作为值。

have you tried this?你试过这个吗?

"ssn": Math.ceil(Math.random() * 1000000000),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM