Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.Boolean'. Path 'users[0].marked_email_as_spam' #171

Open
dradovic opened this issue Nov 25, 2021 · 0 comments

Comments

@dradovic
Copy link

For some old contacts (> 5 yrs), we get the following error when trying to list a user:

Intercom.Exceptions.IntercomException: An exception occurred while calling the endpoint. Method: GET, Url: https://api.intercom.io/, Resource: users, Sub-Resource:

I guess that marked_email_as_spam should be declared as a nullable boolean to support the loading of older contacts.

This is the call-stack:

Intercom.Exceptions.IntercomException: An exception occurred while calling the endpoint. Method: GET, Url: https://api.intercom.io/, Resource: users, Sub-Resource:
---> Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.Boolean'. Path 'users[0].marked_email_as_spam', line 1, position 978.
---> System.InvalidCastException: Null object cannot be converted to a value type.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
--- End of inner exception stack trace ---
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Intercom.Core.Client.Deserialize[T](String data)
at Intercom.Core.Client.HandleNormalResponse[T](IRestResponse response)
at Intercom.Core.Client.HandleResponse[T](IRestResponse response)
at Intercom.Core.Client.Get[T](Dictionary`2 headers, Dictionary`2 parameters, String resource)
--- End of inner exception stack trace ---
at Intercom.Core.Client.Get[T](Dictionary`2 headers, Dictionary`2 parameters, String resource)
at Intercom.Clients.UsersClient.List(Dictionary`2 parameters)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant