step-up-labs / firebase-storage-dotnet

C# library for Firebase Storage
MIT License
143 stars 36 forks source link

Getting Json Parsing Error when resultContent is having metadata #13

Closed yawarkhan15 closed 6 years ago

yawarkhan15 commented 6 years ago

Code var result = await http.GetAsync(url); resultContent = await result.Content.ReadAsStringAsync().ConfigureAwait(false); var data = JsonConvert.DeserializeObject<Dictionary<string,string>>(resultContent);

Sample Result Content { "name": "*****/*******.nessus", "bucket": "****.appspot.com", "generation": "1519292246046168", "metageneration": "1", "contentType": "application/octet-stream", "timeCreated": "2018-02-22T09:37:26.043Z", "updated": "2018-02-22T09:37:26.043Z", "storageClass": "STANDARD", "size": "2756082", "md5Hash": "", "contentEncoding": "identity", "contentDisposition": "inline; filename*=utf-8''*******%20%282%29.nessus", "crc32c": "CY6yWQ==", "etag": "CNjritWcudkCEAE=", "downloadTokens": "", "metadata": { "app": "" } }

Error Unexpected character encountered while parsing value: {. Path 'metadata', line 17, position 15.

at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType) at Newtonsoft.Json.JsonTextReader.ReadAsString() at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Firebase.Storage.FirebaseStorageReference.d__6.MoveNext() in D:\Projects\Nehemiah\rq-prototype.backendapi\Nehemiah.Prototype.API\Firebase.Storage\FirebaseStorageReference.cs:line 61