public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
                                        JsonSerializer serializer)
        {
            reader.Read();
            if (reader.TokenType != JsonToken.PropertyName)
            {
                return(null);
            }

            var key = reader.Value as string;

            reader.Read();
            switch (key)
            {
            case "delete":
                var deleteItem = new BulkDeleteResponseItem();
                serializer.Populate(reader, deleteItem);
                if (deleteItem != null)
                {
                    deleteItem.Operation = key;
                }
                reader.Read();
                return(deleteItem);

            case "update":
                var updateItem = new BulkUpdateResponseItem();
                serializer.Populate(reader, updateItem);
                if (updateItem != null)
                {
                    updateItem.Operation = key;
                }
                reader.Read();
                return(updateItem);

            case "index":
                var indexItem = new BulkIndexResponseItem();
                serializer.Populate(reader, indexItem);
                if (indexItem != null)
                {
                    indexItem.Operation = key;
                }
                reader.Read();
                return(indexItem);

            case "create":
                var createItem = new BulkCreateResponseItem();
                serializer.Populate(reader, createItem);
                if (createItem != null)
                {
                    createItem.Operation = key;
                }
                reader.Read();
                return(createItem);
            }
            return(null);
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
                                        JsonSerializer serializer)
        {
            JObject o = JObject.Load(reader);

            var prop = o.Properties().First();
            var key  = prop.Name;

            switch (key)
            {
            case "delete":
                var deleteItem = new BulkDeleteResponseItem();
                serializer.Populate(prop.Value.CreateReader(), deleteItem);
                if (deleteItem != null)
                {
                    deleteItem.Operation = key;
                }
                return(deleteItem);

            case "update":
                var updateItem = new BulkUpdateResponseItem();
                serializer.Populate(prop.Value.CreateReader(), updateItem);
                if (updateItem != null)
                {
                    updateItem.Operation = key;
                }
                return(updateItem);

            case "index":
                var indexItem = new BulkIndexResponseItem();
                serializer.Populate(prop.Value.CreateReader(), indexItem);
                if (indexItem != null)
                {
                    indexItem.Operation = key;
                }
                return(indexItem);

            case "create":
                var createItem = new BulkCreateResponseItem();
                serializer.Populate(prop.Value.CreateReader(), createItem);
                if (createItem != null)
                {
                    createItem.Operation = key;
                }
                return(createItem);
            }
            return(null);
        }
		public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
										JsonSerializer serializer)
		{
			reader.Read();
			if (reader.TokenType != JsonToken.PropertyName)
				return null;

			var key = reader.Value as string;
			reader.Read();
			switch (key)
			{
				case "delete":
					var deleteItem = new BulkDeleteResponseItem();
					serializer.Populate(reader, deleteItem);
					if (deleteItem != null)
						deleteItem.Operation = key;
					reader.Read();
					return deleteItem;
				case "update":
					var updateItem = new BulkUpdateResponseItem();
					serializer.Populate(reader, updateItem);
					if (updateItem != null)
						updateItem.Operation = key;
					reader.Read();
					return updateItem;
				case "index":
					var indexItem = new BulkIndexResponseItem();
					serializer.Populate(reader, indexItem);
					if (indexItem != null)
						indexItem.Operation = key;
					reader.Read();
					return indexItem;
				case "create":
					var createItem = new BulkCreateResponseItem();
					serializer.Populate(reader, createItem);
					if (createItem != null)
						createItem.Operation = key;
					reader.Read();
					return createItem;
			}
			return null;
		}
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
            JsonSerializer serializer)
        {
            JObject o = JObject.Load(reader);

            var prop = o.Properties().First();
            var key = prop.Name;
            switch (key)
            {
                case "delete":
                    var deleteItem = new BulkDeleteResponseItem();
                    serializer.Populate(prop.Value.CreateReader(), deleteItem);
                    if (deleteItem != null)
                        deleteItem.Operation = key;
                    return deleteItem;
                case "update":
                    var updateItem = new BulkUpdateResponseItem();
                    serializer.Populate(prop.Value.CreateReader(), updateItem);
                    if (updateItem != null)
                        updateItem.Operation = key;
                    return updateItem;
                case "index":
                    var indexItem = new BulkIndexResponseItem();
                    serializer.Populate(prop.Value.CreateReader(), indexItem);
                    if (indexItem != null)
                        indexItem.Operation = key;
                    return indexItem;
                case "create":
                    var createItem = new BulkCreateResponseItem();
                    serializer.Populate(prop.Value.CreateReader(), createItem);
                    if (createItem != null)
                        createItem.Operation = key;
                    return createItem;
            }
            return null;
        }