public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var j = JObject.Load(reader);

            if (j == null || !j.HasValues)
            {
                return(null);
            }
            IGeoDistanceFilter filter = new GeoDistanceFilterDescriptor();

            foreach (var jv in j)
            {
                switch (jv.Key)
                {
                case "distance":
                    filter.Distance = jv.Value.Value <string>();
                    break;

                case "distance_type":
                    filter.DistanceType = jv.Value.Value <string>().ToEnum <GeoDistance>();
                    break;

                case "optimize_bbox":
                    filter.OptimizeBoundingBox = jv.Value.Value <string>().ToEnum <GeoOptimizeBBox>();
                    break;

                case "unit":
                    filter.Unit = jv.Value.Value <string>().ToEnum <GeoUnit>();
                    break;

                case "_cache":
                    filter.Cache = jv.Value.Value <bool>();
                    break;

                case "_cache_key":
                    filter.CacheKey = jv.Value.Value <string>();
                    break;

                case "_name":
                    filter.FilterName = jv.Value.Value <string>();
                    break;

                default:
                    filter.Field    = jv.Key;
                    filter.Location = jv.Value.Value <string>();
                    break;
                }
            }



            return(filter);
        }
		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
		{
			var j = JObject.Load(reader);
			if (j == null || !j.HasValues)
				return null;
			IGeoDistanceFilter filter = new GeoDistanceFilterDescriptor();
			foreach (var jv in j)
			{
				switch (jv.Key)
				{
					case "distance":
						filter.Distance = jv.Value.Value<string>();
						break;
					case "distance_type":
						filter.DistanceType = jv.Value.Value<string>().ToEnum<GeoDistance>();
						break;
					case "optimize_bbox":
						filter.OptimizeBoundingBox = jv.Value.Value<string>().ToEnum<GeoOptimizeBBox>();
						break;
					case "unit":
						filter.Unit = jv.Value.Value<string>().ToEnum<GeoUnit>();
						break;
					case "_cache":
						filter.Cache = jv.Value.Value<bool>();
						break;
					case "_cache_key":
						filter.CacheKey = jv.Value.Value<string>();
						break;
					case "_name":
						filter.FilterName = jv.Value.Value<string>();
						break;
					default:
						filter.Field = jv.Key;
						filter.Location = jv.Value.Value<string>();
						break;
				}
			}



			return filter;

		}