Esempio n. 1
0
        private async Task <IResourceObject[]> DeserializePrimaryData(JsonReader reader, string currentPath)
        {
            if (reader.TokenType != JsonToken.StartArray)
            {
                throw new JsonSerializationException("Expected an array, but encountered " + reader.TokenType);
            }

            var primaryData = new List <IResourceObject>();

            var index = 0;

            while (reader.Read())
            {
                if (reader.TokenType == JsonToken.EndArray)
                {
                    break;
                }

                var resourceObject = await ResourceObjectFormatter.Deserialize(reader, currentPath + "/" + index);

                primaryData.Add(resourceObject);

                index++;
            }

            return(primaryData.ToArray());
        }
        private async Task <IResourceObject> DeserializePrimaryData(JsonReader reader, string currentPath)
        {
            if (reader.TokenType == JsonToken.Null)
            {
                return(null);
            }

            var primaryData = await ResourceObjectFormatter.Deserialize(reader, currentPath);

            return(primaryData);
        }