How can I parse a JSON string that would cause illegal C# identifiers? -


I am using the library to convert and convert the JSN string to the C # object. But now I have actually come in strangely JSON string and I am unable to convert it into C # object because I can not create a C # class from this JSON string.

There is a JSON string

  {"1": {"fajr": "04:15", "sunrise": "05:42", "zohar" : "12:30", "asr": "15:53", "Maghrib": "1 9:18", "Isha": "20:40"}, "2": {"Fajr": "04 : 15 "," Sunrise ":" 05:42 "," Zuhr "" 12:30 "," ASR ":" 15:53 ​​"," Meghrich ":" 19:18 "," Isha ": "20:41"}}  

To parse this JSON string, there must be a required C # class:

  public class 1 {public string fuzz } Set; } Public string sunrise {get; Set; } Get public string zuhr {get; Set; } Public string asr {get; Set; } Public string string {receive; Set; } Public String Isha {Receive; Set; }} Set to public square 2 {public string fog}; } Public string sunrise {get; Set; } Get public string zuhr {get; Set; } Public string asr {get; Set; } Public string string {receive; Set; } Public String Isha {Receive; Set; }}  

But this is not a true C # class because we know that the class names can not begin with a number.

It would be really good if anybody can suggest how to parse such a Jason string.

You can deserialize in a dictionary.

  sets the public square item {public string fog}; } Public string sunrise {get; Set; } Get public string zuhr {get; Set; } Public string asr {get; Set; } Public string string {receive; Set; } Public String Isha {Receive; Set; }}  

  var dict = JsonConvert.DeserializeObject & lt; Dictionary & lt; String, Items & gt; & Gt; (Json);  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -