Retrieve the values from json string

后端 未结 5 782
忘掉有多难
忘掉有多难 2021-01-26 05:33

I have json string. I want to retrieve the contact from json string. Following json contains array of contacts. here is my json string

5条回答
  •  情深已故
    2021-01-26 05:57

    You need to go with the following structure:

    public class Contact
        {
            public bool isConnection { get; set; }
            public int id { get; set; }
            public List fields { get; set; }
        }
    public class Field
    {
        public int id { get; set; }
        public string type { get; set; }
        public object value { get; set; }
        public string editedBy { get; set; }
        public string[] flags { get; set; }
        public string[] categories { get; set; }
        public DateTime updated { get; set; }
        public DateTime created { get; set; }
    }
    
    public class Name
    {
        public string givenName { get; set; }
        public string middleName { get; set; }
        public string familyName { get; set; }
        public string prefix { get; set; }
        public string suffix { get; set; }
        public string givenNameSound { get; set; }
        public string familyNameSound { get; set; }
    }
    

    And then deserialize it and use LINQ to manipulate fields.

提交回复
热议问题