I get external json data and want to deserialize to my collection:
var responseString = await response.Content.ReadAsStringAsync();
var result = JsonParse.ParseArrayCamelCase<ReadOnlyCollection<SureMdmGroup>>(responseString, "Groups");
return result;
where ParseArrayCamelCase
is:
public static T ParseArrayCamelCase<T>(string txt, string arrayName)
{
JObject json = JObject.Parse(txt);
var items = json[arrayName].ToString();
JsonSerializerSettings serSettings = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
Formatting = Formatting.Indented,
StringEscapeHandling = StringEscapeHandling.EscapeHtml
};
return JsonConvert.DeserializeObject<T>(items, serSettings);
}
it works, but if some string like
E&B Transport, LLC.
it should be converted to
E&B Transport, LLC.
What should I set for JsonSerializerSettings
to decode strings?