Skip to content

Instantly share code, notes, and snippets.


Nek-/error Secret

Last active Aug 5, 2020
What would you like to do?
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.
namespace Me.Models
class SomethingToTest
public string id { get; set; }
"@id": "/foo/id",
"otherFields": [ {"mayBe": "Complexe"} ]
var client = new RestClient("https://localhost:8000");
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment