Is it possible to serialize string property value as "raw" text, not as string with double quoutes (that naturally happens).
public class Demo
{
public int IntValue { get; set; }
public string StrValue { get; set; }
public string RawValue { get; set; }
}
Demo obj = new Demo { IntValue = 1, StrValue = "abc", RawValue = "{\"intProp\": 123 }" };
string result = System.Text.Json.JsonSerializer.Serialize(obj);
Console.WriteLine(result);
Output:
{
"IntValue":1,
"StrValue":"abc",
"RawValue":"{intProp: 123 }"
}
Expected output:
{
"IntValue":1,
"StrValue":"abc",
"RawValue": {intProp: 123 }
}
Thank you in advance!