HubSpot API v5.3.0 deal creation suddenly failing with JSON deserialization error

I’m using an older version of the HubSpot PHP API (v5.3.0) and I’ve run into a problem. My code for creating deals used to work fine, but now it’s throwing an error about invalid JSON. Here’s what I’m doing:

$result = $hubspotClient->deals()->create($dealProps, $companyAssoc);

The $hubspotClient is a working SevenShores\Hubspot\Http\Client instance. $dealProps is an array with stuff like:

[
  ['name' => 'dealname', 'value' => 'New Sale']
]

And $companyAssoc has the associated company ID.

The error I’m getting is:

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’m confused because I didn’t change anything in my code. Has anyone else run into this? Any ideas on how to fix it without upgrading the API version? Thanks!

hey there, i ran into somethin similar recently. turns out hubspot made some changes on their end that broke older api versions. frustrating, right? :triumph:

quick fix: try wrapping ur dealProps in another array like this:

$result = $hubspotClient->deals()->create([$dealProps], $companyAssoc);

might solve ur issue without upgrading. good luck!