Json 在邮递员中发布objectId

Json 在邮递员中发布objectId,json,node.js,mongoose,schema,postman,Json,Node.js,Mongoose,Schema,Postman,我正在尝试使用postman将此json发布到API { "order" : [{ "mealId": 562b2649b2e70464f113c04d, "quantity": 4}], "service_id" : 562b2649b2e70464f113c04d, "dest" : "Allabama", "active": false } 但我总是犯这个错误 SyntaxError: Unexpected token b at Object.parse (native)

我正在尝试使用postman将此json发布到API

{
"order" : [{ "mealId": 562b2649b2e70464f113c04d, "quantity": 4}],
"service_id" : 562b2649b2e70464f113c04d,
"dest" : "Allabama",
"active": false
}
但我总是犯这个错误

SyntaxError: Unexpected token b at Object.parse (native) at parse (C:\nodeprojects\foodDelivery\node_modules\body-parser\lib\types\json.js:88:17) at C:\nodeprojects\foodDelivery\node_modules\body-parser\lib\read.js:108:18 at invokeCallback (C:\nodeprojects\foodDelivery\node_modules\body-parser\node_modules\raw-body\index.js:262:16) at done (C:\nodeprojects\foodDelivery\node_modules\body-parser\node_modules\raw-body\index.js:251:7) at IncomingMessage.onEnd (C:\nodeprojects\foodDelivery\node_modules\body-parser\node_modules\raw-body\index.js:308:7) at IncomingMessage.emit (events.js:104:17) at _stream_readable.js:908:16 at process._tickCallback (node.js:355:11)
简而言之,问题是当我试图传递ObjectId时,它在“562”之后停止读取,并将“b”视为非法字符。

您必须引用字符串:

{
"order" : [{ "mealId": "562b2649b2e70464f113c04d", "quantity": 4}],
"service_id" : "562b2649b2e70464f113c04d",
"dest" : "Allabama",
"active": false
}

将_id对象作为字符串而不是ObjectId接收, 当您获得此id时,创建新的mongo.driver对象id

 public async Task<IHttpActionResult> PostExample(string idinstring)
 {
         ObjectId d=new ObjectId(idinstring);
  }
公共异步任务PostExample(字符串)
{
ObjectId=新的ObjectId(字符串);
}

当我尝试这样做时,会出现“意外字符串”错误,因为它需要的是ObjectId而不是StringThank!第一次尝试时,我不小心在一个实体后漏掉了一个逗号。将它们放在引号中修复了它。再次感谢!当我从postman传递类似这样的值时,我在ObjectId字段中得到了{000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000。。。。我正在使用c#驱动程序。。有什么解决方案吗?我如何传递对象ID数组?
 public async Task<IHttpActionResult> PostExample(string idinstring)
 {
         ObjectId d=new ObjectId(idinstring);
  }