Q:

Problems when a json string has extra " in it using JObject.Parse

The Following string gives an error when using the following code:
 data = await resposta.Content.ReadAsStringAsync();
 dynamic j = JObject.Parse(data);

The data in contains the following string:
{"code": 100, "message": "The entity with the name "Esther Rea" its not in DB."}

How to take off the " from Esther Rea?

A:

As suggested, the correct solution would be to have whoever's returning this value escape the quotes. However, if that's really not an option, you can try to brute-force your way into escaping the double quotes yourself, assuming the return schema is always the same, using something like this:
var pattern = "(\"message\":\\s+\")(?<messageContent>(.*))(\"})";
var regex = Regex.Match(data, pattern);

var message = regex.Groups["messageContent"].Value;

if (!string.IsNullOrEmpty(message))
{
    message = message.Replace("\"", "\\\"");
    var newData = Regex.Replace(data, pattern, "$1" + message + "$3");

    var jObject = JObject.Parse(newData);
}

This will extract the actual message string and escapes all double quotes in it (message.Replace("\"", "\\\"");), causing serialization to succeed.
If you really want to remove the quotes instead of escaping them, you can do message = message.Replace("\"", "");

