I have the following DTO:
public class MyDTO
{
public int Id { get; set; }
public String Info { get; set; }
}
The Info element contains some serialized JSON object which can be of multiple different types.
In my service function, I return this DTO using return x.ConvertTo<MyDTO>()
My problem is, that, since ServiceStack is not aware that Info holds a JSON, the special characters (quotation marks) of Info are escaped.
So I get
{"Id":15,"Info":"[\"Test1\",\"Test2\",\"Test3\"]"}
from the service, but what I would like to get is actually
{"Id":15,"Info":["Test1","Test2","Test3"]}
Is there some way, to tell ServiceStack that Info holds JSON data and thus prevent it from escaping the string and instead inserting the JSON value directly into the response?
P.S.: My question is not a duplicate of that question, which is concerned with forcing the default DTO encoding of a service to JSON, while my problem deals with how the JSON encoding happens for certain types.