This project is read-only.
1

Closed

Deserialization fails

description

I deserialize the attached JSON using the following class definition:
    public class Twitter
    {
        public Query query { get; set; }
        public Result result { get; set; }

        public class Query
        {
            public Parameters @params { get; set; }
            public string type { get; set; }
            public string url { get; set; }
        }

        public class Parameters
        {
            public int accuracy { get; set; }
            public bool autocomplete { get; set; }
            public string granularity { get; set; }
            public string query { get; set; }
            public bool trim_place { get; set; }
        }

        public class Result
        {
            public Place[] places { get; set; }
        }

        public class Place
        {
            public Attributes attributes { get; set; }
            public BoundingBox bounding_box { get; set; }
            public Place[] contained_within { get; set; }

            public string country { get; set; }
            public string country_code { get; set; }
            public string full_name { get; set; }
            public string id { get; set; }
            public string name { get; set; }
            public string place_type { get; set; }
            public string url { get; set; }
        }
        
        public class Attributes
        {
        }

        public class BoundingBox
        {
            public double[][][] coordinates  { get; set; }
            public string type { get; set; }
        }
    }
I am going to deserialize into the Twitter class, but the following exception is thrown
Object must implement IConvertible.
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at fastJSON.deserializer.ChangeType(Object value, Type conversionType)
   at fastJSON.deserializer.CreateArray(List`1 data, Type pt, Type bt, Dictionary`2 globalTypes)
   at fastJSON.deserializer.ParseDictionary(Dictionary`2 d, Dictionary`2 globaltypes, Type type, Object input)
   at fastJSON.deserializer.ParseDictionary(Dictionary`2 d, Dictionary`2 globaltypes, Type type, Object input)
   at fastJSON.deserializer.CreateArray(List`1 data, Type pt, Type bt, Dictionary`2 globalTypes)
   at fastJSON.deserializer.ParseDictionary(Dictionary`2 d, Dictionary`2 globaltypes, Type type, Object input)
   at fastJSON.deserializer.ParseDictionary(Dictionary`2 d, Dictionary`2 globaltypes, Type type, Object input)
   at fastJSON.deserializer.ToObject(String json, Type type)
   at fastJSON.deserializer.ToObject[T](String json)
   at fastJSON.JSON.ToObject[T](String json, JSONParameters param)

file attachments

Closed Jul 15, 2016 at 3:29 PM by MGholam
Fixed in 2.1.17

comments