I want to serialize a object that has a string property with value: " if(_inputs.loopInput == \"2\"){\n return true\n }\n else{\n return false;\n }"
The issue is that, when I do serialize it, the value transforms it self in: " if(_inputs.loopInput == \\u00222\\u0022){\\n return true\\n }\\n else{\\n return false;\\n }\"
I would like to get rid of this \u00222\u0022 in the escaped "2".
Does any one know why this happens?
Before this, I was using Newtonsoft, and when I invoke the serialize method, I pass this parameters:
JsonConvert.SerializeObject(_data,
Formatting.None,
settings ?? new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });
Getting this result:
"{\"code\":\" if(_inputs.loopInput == \\\"2\\\"){\\n return true\\n }\\n else{\\n return false;\\n }\"
I would like to get the same result, but using System.Text.Json.
This is how I am using:
JsonSerializer.Serialize(lambdaCallBody);
Summing up...
Desired serialize result (using NewtonSoft):
"{\"code\":\" if(_inputs.loopInput == \\\"2\\\"){\\n return true\\n }\\n else{\\n return false;\\n }\",\"inputs\":{\"loopInput\":\"2\"},\"execInfo\":{\"tenant\":\"__TEST__agentFlowV3\",\"flowId\":\"5e9736ff554defb30152a9a2\",\"jobId\":\"1586968416402\"}}"
What I am getting (using System.Text.Json):
"{\"code\":\" if(_inputs.loopInput == \\u00222\\u0022){\\n return true\\n }\\n else{\\n return false;\\n }\",\"inputs\":{\"loopInput\":\"\\u00222\\u0022\"},\"execInfo\":{\"tenant\":\"__TEST__agentFlowV3\",\"flowId\":\"5e9736ff554defb30152a9a2\",\"jobId\":\"1586968416402\",\"mappingFunction\":null,\"functionReferences\":null}}"