Hello,
I have the REST interface and would like to log the data, request, response.
To make it clearer, correct JSON format.
I notice this behavior.
What would be a good solution for logging?
"serial":"233124325000000043","batchNum":"G77777789", --> looks ok
"serial\":\"233124325000000030\",\"batchNum\":\"G77777789\" --> looks wrong
Why this character \"
string dataObjectsAsString = Newtonsoft.Json.JsonConvert.SerializeObject(dataObjects, Newtonsoft.Json.Formatting.Indented);
Log.WriteLog($"[CUSTOM][MES_Step2_ExecuteGetSerialAssignments] response=\n{dataObjectsAsString}");
{
"Result": "{\"error\":0,\"msg\":\"\",\"product_info\":{\"order\":\"DWO-0001\",\"partnum\":\"8888887777\",\"partrev\":\"A3\",\"bom_number\":\"8888887777\",\"bom_revision\":\"A3\",\"cust_name\":null,\"cust_partnum\":null,\"cust_partrev\":null,\"cust_bom_number\":null,\"cust_bom_revision\":null,\"cust_upc_code\":null,\"mrk_partnum\":null,\"mrk_partrev\":null},\"carrier_id\":\"233124325000000025\",\"serial_list\":[{\"serial\":\"233124325000000025\",\"lotnum\":\"G77777789\",\"datecode\":\"243\",\"cust_serial\":null,\"cust_datecode\":null,\"country_of_origin\":\"USA\"},{\"serial\":\"233124325000000026\",\"lotnum\":\"G77777789\",\"datecode\":\"243\",\"cust_serial\":null,\"cust_datecode\":null,\"country_of_origin\":\"USA\"},{\"serial\":\"233124325000000027\",\"lotnum\":\"G77777789\",\"datecode\":\"243\",\"cust_serial\":null,\"cust_datecode\":null,\"country_of_origin\":\"USA\"},{\"serial\":\"233124325000000028\",\"lotnum\":\"G77777789\",\"datecode\":\"243\",\"cust_serial\":null,\"cust_datecode\":null,\"country_of_origin\":\"USA\"},{\"serial\":\"233124325000000029\",\"lotnum\":\"G77777789\",\"datecode\":\"243\",\"cust_serial\":null,\"cust_datecode\":null,\"country_of_origin\":\"USA\"},{\"serial\":\"233124325000000030\",\"batchNum\":\"G77777789\",\"datecode\":\"243\",\"cust_serial\":null,\"cust_datecode\":null,\"country_of_origin\":\"USA\"}]}",
"Id": 36,
"Exception": null,
"Status": 5,
"IsCanceled": false,
"IsCompleted": true,
"CreationOptions": 0,
"AsyncState": null,
"IsFaulted": false
}
var dataObjects = response.Content.ReadAsStringAsync();
Log.Write($"[CUSTOM][GetSerialAssignments] response=\n{dataObjects.Result}");
response=
{"error":0,"msg":"","product_info":{"order":"DWO-0001","partnum":"8888887777","partrev":"A3","bom_number":"8888887777","bom_revision":"A3","cust_name":null,"cust_partnum":null,"cust_partrev":null,"cust_bom_number":null,"cust_bom_revision":null,"cust_upc_code":null,"mrk_partnum":null,"mrk_partrev":null},"carrier_id":"233124325000000040","serial_list":[{"serial":"233124325000000040","batchNum":"G77777789","datecode":"243","cust_serial":null,"cust_datecode":null,"country_of_origin":"USA"},{"serial":"233124325000000041","batchNum":"G77777789","datecode":"243","cust_serial":null,"cust_datecode":null,"country_of_origin":"USA"},{"serial":"233124325000000042","batchNum":"G77777789","datecode":"243","cust_serial":null,"cust_datecode":null,"country_of_origin":"USA"},{"serial":"233124325000000043","batchNum":"G77777789","datecode":"243","cust_serial":null,"cust_datecode":null,"country_of_origin":"USA"},{"serial":"233124325000000044","batchNum":"G77777789","datecode":"243","cust_serial":null,"cust_datecode":null,"country_of_origin":"USA"},{"serial":"233124325000000045","batchNum":"G77777789","datecode":"243","cust_serial":null,"cust_datecode":null,"country_of_origin":"USA"}]}