I’m having trouble with the HubSpot API v5.3.0 in PHP. I’ve been using it to create deals without any problems, but now it’s throwing an error about invalid JSON. Here’s what I’m doing:
This used to work fine, but now I’m getting this error:
Invalid input JSON on line 1, column 342: Trailing token (of type END_OBJECT) found after value (bound as com.hubspot.deals.base.DealView): not allowed as per DeserializationFeature.FAIL_ON_TRAILING_TOKENS
I haven’t changed anything in my code. Does anyone know what’s going on or how to fix this? I can’t upgrade to a newer version right now. Thanks for any help!
I encountered a similar issue with the HubSpot API v5.3.0 recently. The problem seems to stem from changes in how the API handles JSON serialization. Instead of passing the associations directly in the create() method, I had to set them separately using the associateWithCompany() method after creating the deal. Here’s the modified approach:
This workaround resolved the JSON deserialization error for me. It’s not ideal, but it should get you unstuck until you can upgrade to a newer version that addresses this issue directly.
hey tom, i ran into this too. the api changed smthing without tellin us. try removing the associations param from ur create() call. just use $result = $hubspot->deals()->create($properties); that worked 4 me. let me kno if it helps!