public override object ReadJson(JsonReader reader,
                                        Type objectType, object existingValue, JsonSerializer serializer)
        {
            JToken token = JToken.Load(reader);

            if (token.Type == JTokenType.Object)
            {
                var stoppedString = new StoppedString {
                    Stops = new List <KeyValuePair <float, string> >()
                };

                stoppedString.Base = token.SelectToken("base").ToObject <float>();

                foreach (var stop in token.SelectToken("stops"))
                {
                    var zoom = (float)stop.First.ToObject <float>();
                    var text = stop.Last.ToObject <string>();
                    stoppedString.Stops.Add(new KeyValuePair <float, string>(zoom, text));
                }

                return(stoppedString);
            }

            return(new StoppedString()
            {
                SingleVal = token.Value <string>()
            });
        }
        public StoppedString CreateStoppedString(JToken token)
        {
            var stoppedString = new StoppedString {
                Stops = new List <KeyValuePair <float, string> >()
            };

            stoppedString.Base = token.SelectToken("base").ToObject <float>();

            foreach (var stop in token.SelectToken("stops"))
            {
                var zoom = (float)stop.First.ToObject <float>();
                var text = stop.Last.ToObject <string>();
                stoppedString.Stops.Add(new KeyValuePair <float, string>(zoom, text));
            }

            return(stoppedString);
        }