如何在Postman中添加注释?具体来说,如何在JSON请求正文部分添加注释?
我想注释掉请求正文中的特定键或值,以便它不会被发送。
使用//
或 /* ... */
来注释 JSON 键/值对将在Postman中显示为样式化的注释:
但是发送此请求会导致服务器错误,例如下面的错误提示,并且很明显,被注释的行作为请求正文的一部分被发送:
Unexpected character ('/' (code 47)): maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser) at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 2, column: 6 ]
JSON规范不允许使用注释:Can comments be used in JSON?
我希望Postman在请求发送之前剥离掉被注释的行。
"_comment": "comment text goes here..."
。当然,注释掉一些JSON数据的技巧就是简单地更改要“禁用”的键的名称。 - Henke