I have a json request like this:
{
"record_type": "item",
"data": [
{
"item_id_wms": 75985,
"item_type": "Inventory",
"item_code": "ITEM8080808",
"display_name": "ITEM E888",
"category_item": "",
"upc_code" : 12345678,
"base_unit": "BOX",
"height": 12,
"width": 13,
"depth": 12,
"uom_volume": 10
}
]
}
but I hit use request.setPayload(request.toString()); I got error like this when hitting my other service
Response Body : {"error" : {"code" : "SYNTAX_ERROR", "message" : "org.mozilla.javascript.EcmaError: SyntaxError: Unexpected token: c (INVOCATION_WRAPPER$sys#24)."}}
but if I manually use this code: I can hit my endpoint.
OAuthRequest requestSendToNS = new OAuthRequest(Verb.POST, baseUrl);
requestSendToNS.setPayload(("{\"record_type\":\"item\", \"data\": [ { \"item_id_wms\": 99920, \"item_type\": \"kit\", \"item_code\": \"ITEM808080\", \"display_name\": \"ITEM E888\", \"category_item\": \"kit\", \"upc_code\" : 12345678, \"base_unit\": \"PCS\", \"height\": 12, \"width\": 13, \"depth\": 12, \"uom_volume\": 10, \"component\" : [ { \"item_id_component\":\"ITMIDAS0000000007\", \"quantity_component\": 18, \"unit_id_component\":\"PCS\" }, { \"item_id_component\":\"ITMIDAS0000000001\", \"quantity_component\": 15, \"unit_id_component\":\"PCS\" } ] }, { \"item_id_wms\": 99922, \"item_type\": \"kit\", \"item_code\": \"ITEM808080\", \"display_name\": \"ITEM E888\", \"category_item\": \"kit\", \"upc_code\" : 12345678, \"base_unit\": \"PCS\", \"height\": 12, \"width\": 13, \"depth\": 12, \"uom_volume\": 10, \"component\" : [ { \"item_id_component\":\"ITMIDAS0000000007\", \"quantity_component\": 18, \"unit_id_component\":\"PCS\" }, { \"item_id_component\":\"ITMIDAS0000000001\", \"quantity_component\": 15, \"unit_id_component\":\"PCS\" } ] }, { \"item_id_wms\": 99924, \"item_type\": \"kit\", \"item_code\": \"ITEM808080\", \"display_name\": \"ITEM E888\", \"category_item\": \"kit\", \"upc_code\" : 12345678, \"base_unit\": \"PCS\", \"height\": 12, \"width\": 13, \"depth\": 12, \"uom_volume\": 10, \"component\" : [ { \"item_id_component\":\"ITMIDAS0000000007\", \"quantity_component\": 18, \"unit_id_component\":\"PCS\" }, { \"item_id_component\":\"ITMIDAS0000000001\", \"quantity_component\": 15, \"unit_id_component\":\"PCS\" } ] } ] }"));
How can I change my json request come in the payload format like that?