0

I have this JSON output from a web service.

{
  "address": "173.194.67.1",
  "country": "US",
  "stateprov": "California",
  "city": "Mountain View"
}

How Do I load it into a List typed as below using Newton Soft JSON library?

public class Item
    {
        public string address;
        public string country;
        public string stateprov;
        public string city;
    }

List items;

I am new to JSON.

thanks.

1
  • gotta take the json string, and deserialize it as a new Item instance Commented Jan 28, 2014 at 19:36

1 Answer 1

3

Your json is not an array just a single object

var item =  JsonConvert.DeserializeObject<Item>(yourjsonstring);
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks L.B. !! Works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.