Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'TotallySpy.Models.Collection`1[TotallySpy.Models.Variation]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. | |
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. | |
Path '', line 1, position 1. |
{ | |
"@id": "/foo/id", | |
"otherFields": [ {"mayBe": "Complexe"} ] | |
} |
var client = new RestClient("https://localhost:8000"); | |
client.UseNewtonsoftJson(); | |
client.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true; | |
client.Authenticator = new JwtAuthenticator(this.Auth0Token); | |
var request = new RestRequest("variations?barcode="+barcode, RestSharp.DataFormat.Json); | |
var response = await client.GetAsync<SomethingToTest>(request); | |
Console.WriteLine(response.id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment