Search code examples
jsonrandomdynamicnumbers

Generating random number inside json file


I want to give a random number in json file which is payload for the API post request. The "ssn" value in json file should be unique everytime. How do we do that?

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

This doesn't work as it take the function as a value.


Solution

  • have you tried this?

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