Skip to content

GetPlaceDetail JSON deserialization error #4

Description

@travisthedeveloper

This is the error message I get:
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[GoogleMapsAPI.NET.API.Places.Components.PlaceOpeningPeriodDayTime]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'result.opening_hours.periods[0].close.day', line 79, position 25.

This is the code to reproduce it:
[code]
var client = new MapsAPIClient(mapApiKey);
var placeId = "ChIJtQ4Qnyt-j4ARL1uo6qaPYv8";
var detail = client.Places.GetPlaceDetails(placeId);
[/code]

I'm using Newtonsoft.Json v11.0,2 if it matters.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions