Dinesh Kumar
asked on
parse Json in C#
Hi Experts,
In the OData Service, I am returning this way
return JsonConvert.SerializeObjec t(List<Dat a> type)
here return type is the String;
The output is as follows:
not sure why there is \\\ symbols.
the question is How can I parse it using a class JsonConvert existing in Newtonsoft.Json
it should be equal to List<Data>
where Data consists of two fields Id and TotalAmount.
Can I use the following class to parse the above json response(if possible)
In the OData Service, I am returning this way
return JsonConvert.SerializeObjec
here return type is the String;
The output is as follows:
string message="{\r\n \"@odata.context\":\"http://localhost:6717/ff-service/$metadata#Edm.String\",\"value\":\"[{\\\"Id\\\":\\\"BPOXE\\\",\\\"TotalAmount\\\":-13.5588},{\\\"Id\\\":\\\"PDXXX\\\",\\\"TotalAmount\\\":0.0}]\"\r\n}";
not sure why there is \\\ symbols.
the question is How can I parse it using a class JsonConvert existing in Newtonsoft.Json
it should be equal to List<Data>
where Data consists of two fields Id and TotalAmount.
Can I use the following class to parse the above json response(if possible)
public class ODataResponse<T>
{
[JsonProperty("odata.metadata")]
public string Metadata { get; set; }
public List<T> Value { get; set; }
}
ASKER
it did not work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Louisfr
Open in new window
.