Search code examples
jsonpostmancomments

Postman JSON Body Comments - I dont want to send comments, just want to use them as reminder for myself


I dont want to send comment as part of JSON, I just want to have a comment as a reminder for my self in PostMan Body tab for JSON request.

For example, I have JSON body like:

/* just some comment here */
{
    "username": "mike",
    "usertype": 1,
    "userid": "3333333",
    "id": "kasd331"
}

If I remove the comment at the top (/* just some comment here */) and send this request and body, it will work. However, with the comment above, PostMan shows me error:

IOExceptionMapper:Unexpected character ('/' (code 47)): maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser) at [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@3b0fb52a; line: 1, column: 2 ]

How can I use comemnts in JSON body in PostMan?


Solution

  • Adding comments as // is a javascript way , in postman javascript is supported only in test and pre request script sections .

    Comments are not supported in body , you can add comments on the the request description or by clicking comment near to the send button.

    enter image description here

    or

    enter image description here But cannot add comments specific to body

    if you click console and check the request body:

    enter image description here

    you can see that what ever you give in body part is send as request body. So if your API is designed to ignore the comment and take only valid json then comment might work , else it won't