I am perplexed as why the DeserializeObject
method cannot deserialize valid JSON:
string source = JsonConvert.SerializeObject(data.Source);
Maintenance ticket_data = JsonConvert.DeserializeObject<Maintenance>(source); //breaks here
When I hit my endpoint, I receive the following:
"ExceptionMessage": "Unexpected character encountered while parsing value: {. Path 'elements', line 21, position 5."
I see where that is happening. Elements
has many different attributes, Elements
is an array.
In the Maintenance
class I have:
public IEnumerable<string> Elements { get; set; }
I used the JSONLint website to make sure source
was valid JSON, and it is.
Some of the JSON output:
{
"doc_type": "ticket",
"updated_date": 12345,
"ticket_number": "1234",
"start": 1234,
"summary": "hello",
"description": "do stuff",
"active": true,
"related_tickets": [],
"tags": [],
"elements": [
{
"last_updated": 5678,
"entry_id": null,
"name": "something",
Any insight as to why I cannot deserialize this JSON would be greatly appreciated.