-
Notifications
You must be signed in to change notification settings - Fork 957
Places: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 408 column 36 path $.result.secondary_opening_hours #906
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
Comments
If you would like to upvote the priority of this issue, please comment below or react with 👍 so we can see what is popular when we triage.@MattWilliams89 Thank you for opening this issue. 🙏
This is an automated message, feel free to ignore. |
I have received the same issue when using Java 17, and sending a request for place with id ChIJhbDp64aLGGAR5ywd2IRem7Q According to the official API documentation here, the secondary_opening_hours field is an Array, which seems to be the cause of the problem |
I bypassed this bug by excluding the secondary_opening_hours field -
|
Here's the same thing in Kotlin if anybody needs it:
|
This is a json response parsing issue of the google library and should be fixed ASAP! That something like this is open for over 2 years should be unacceptable. |
I also ran into this issue when using My workaround was to explicitly only request the fields I needed, which excluded PlaceDetails placeDetails = PlacesApi.placeDetails(context, result.placeId)
.fields(
FieldMask.PLACE_ID,
FieldMask.NAME,
FieldMask.FORMATTED_ADDRESS,
FieldMask.FORMATTED_PHONE_NUMBER,
FieldMask.RATING,
FieldMask.PRICE_LEVEL,
FieldMask.GEOMETRY
)
.await(); This approach avoids the field altogether and ensures you're not requesting more data than necessary. |
@MattWilliams89 do you have something else besides the placeId? Because its expired. Or anyone else got a store/company/place where this happens that I can test? I am working on a PR to fix this. |
Environment details
OS type and version:
Gradle JDK: jbr-17, 17.0.6
Kotlin JVM: 1.8.0
Library version and other environment information:
com.google.maps:google-maps-services:2.2.0
Running on Ktor server v 2.2.3
Steps to reproduce
Code example
Stack trace
Following these steps will guarantee the quickest resolution possible.
Thanks!
The text was updated successfully, but these errors were encountered: