-
-
Save Nek-/63423bba2ec7416bc59cad9756ceb0e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Me.Models | |
{ | |
class SomethingToTest | |
{ | |
[JsonProperty("@id")] | |
public string id { get; set; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"@id": "/foo/id", | |
"otherFields": [ {"mayBe": "Complexe"} ] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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