Answer the question
In order to leave comments, you need to log in
How to parse json in strongly typed languages?
The question has been a bone in the throat for a long time. How do we usually parse json? We write a data model, for example C #:
{result: 0}
[JsonObject(MemberSerialization.Fields)]
public class Response
{
[JsonProperty(PropertyName="result")]
int Result;
}
[JsonObject(MemberSerialization.Fields)]
public class Response
{
[JsonProperty(PropertyName="result")]
Result Result;
}
[JsonObject(MemberSerialization.Fields)]
public class Result
{
[JsonProperty(PropertyName="param")]
int Param;
//итд
}
Answer the question
In order to leave comments, you need to log in
One of the simplest options without any plugins (but only if you know the nesting you need) is to serialize the data into a Dictionary and then typeof.
But, again, you need to understand how you can distinguish a "0" string from a "0" digit. If the structure itself does not allow this, then it is no longer an option ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question