public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
		{
			var response = new SuggestResponse();
			var jsonObject = JObject.Load(reader);
			foreach (var prop in jsonObject.Properties())
			{
				if (prop.Name == "_shards")
					response.Shards = prop.Value.ToObject<ShardsMetaData>();
				else 
					response.Suggestions.Add(prop.Name, prop.Value.ToObject<Suggest[]>());
			}

			return response;
		}
Пример #2
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var response   = new SuggestResponse();
            var jsonObject = JObject.Load(reader);

            foreach (var prop in jsonObject.Properties())
            {
                if (prop.Name == "_shards")
                {
                    response.Shards = prop.Value.ToObject <ShardsMetaData>();
                }
                else
                {
                    response.Suggestions.Add(prop.Name, prop.Value.ToObject <Suggest[]>());
                }
            }

            return(response);
        }