1

Json Data

{
    "user" : 
    {
        "name" : "asdf",
        "teamname" : "b",
        "email" : "c"
    },
    {
        "name" : "asdf",
        "teamname" : "b"
    }
}

Since there are no emails in 2 lines Object Null Reference exceptions. data control

How to do field control ???

uğur
  • 7
  • 2
  • Can you post the code you are using to parse the JSON? – John M. Wright Jun 08 '17 at 00:14
  • 1
    That's not even a valid json... – Gusman Jun 08 '17 at 00:15
  • Like @Gusman pointed out, fix your json and [this](https://stackoverflow.com/a/10439479/4225626) should help you with your null handling. – Yatin Jun 08 '17 at 00:18
  • Your JSON isn't a valid JSON. Your JSON should look like this: { "user" :[ { "name" : "asdf", "teamname" : "b", "email" : "c" }, { "name" : "asdf", "teamname" : "b", "email" : "c" }] } – Sean Stayns Jun 08 '17 at 00:33
  • And if my attention is right, this is the class you should use: public class User { public string name { get; set; } public string teamname { get; set; } public string email { get; set; } } public class RootObject { public List user { get; set; } } You can convert your JSON in the RootObject with this line of code: RootObject myObject = new JavaScriptSerializer().Deserialize(JSONStringVariable); – Sean Stayns Jun 08 '17 at 00:33

0 Answers0