Skip to content

Unexpected character exception deserializing response from ContactsClient.List()  #160

@iPlexor

Description

@iPlexor

Using the nuget release 2.1.1 and the current master branch, calling List() on ContactsClient results in a sucessful request and response but throws an exception when deserializing the response json into the Contacts class.

Inner Exception Message:

Unexpected character encountered while parsing value: {. Path 'pages.next', line 1, position 18348.

This appears to be due to the v2.0 API returning a 'next' pagination object, rather than a string as expected in the current class data structure.

This can be fixed by providing a Next class as follows:

namespace Intercom.Data
{
	public class Next
	{
		public int page { get; set; }
		public string starting_after { get; set; }
	}
}

and switching next in Page.cs from a string to this the new object like so:

namespace Intercom.Data
{
	public class Pages : Model
	{
		public Next next { get; set; }
		public int page { get; set; }
		public int per_page { get; set; }
		public int total_pages { get; set; }
	}
}

I will prepare a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions