Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to send undefined value in postman?

Is there a way to send something like this in postman?

{
 "a": [undefined, {"b":"ball", "c":"cat"}]
}

Postman gives a red underline under undefined. If I use the pre-request script to pm.variables.set('undefinedVariable', undefined); and use this, then my code is giving this error

{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "Invalid request payload JSON format"
}

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It has nothing to do with node.js nor postman. undefined is not a valid json value even though it is valid in javascript. You may be able to use null instead

https://stackoverflow.com/a/14946821/6785908

  • undefined is not a valid JSON value, even though it is valid in javascript.

    From the official JSON
    standard

    (ECMA-404, Section 5):

    A JSON value can be an object, array, number, string, true, false, or null.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading