# Creating a deal in PHP using API v5.3.0 suddenly errors with DeserializationFeature.FAIL\_ON\_TRAILING

**URL:** <https://community.hubspot.com/t/creating-a-deal-in-php-using-api-v5-3-0-suddenly-errors-with-deserializationfeature-fail-on-trailing/124313>\
**Category:** APIs & Integrations\
**Tags:** object\
**Created:** [January 19, 2025, 5:18pm UTC](https://community.hubspot.com/t/creating-a-deal-in-php-using-api-v5-3-0-suddenly-errors-with-deserializationfeature-fail-on-trailing/124313 "2025-01-19T17:18:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsantoro47](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rsantoro47](https://community.hubspot.com/u/rsantoro47)\
**Post date:** [January 19, 2025, 5:18pm UTC](https://community.hubspot.com/t/creating-a-deal-in-php-using-api-v5-3-0-suddenly-errors-with-deserializationfeature-fail-on-trailing/124313/1 "2025-01-19T17:18:35Z")

</div>

I know I am using an old version of the PHP API, but I cannot afford the time at the moment or errors it may cause to upgrade to the newer versions.

I have had no issues creating deals in the past, using the following code:

$result = $this-\>\_HubSpotIntegrator-\>deals()-\>create($properties, $associations);

Where $this-\>\_HubSpotIntegrator is a valid SevenShores\Hubspot\Http\Client class (and other API functions work fine) and $properties is an array setup with each row =\>

name =“dealname”

value =“Test”

and $associations is an array with one association: associatedCompanyIds =“#########”.

This code used to work with no issues, and I changed nothing on my end, and now I recieve the following error message:

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 do not understand how the JSON string is invalid with the HubSpot class generated it and I do not know what I need to change in order to get this working again. Any assistance is appreciatrd.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [January 21, 2025, 3:57pm UTC](https://community.hubspot.com/t/creating-a-deal-in-php-using-api-v5-3-0-suddenly-errors-with-deserializationfeature-fail-on-trailing/124313/2 "2025-01-21T15:57:16Z")

</div>

Hey, @rsantoro47 👋 Thank you for posting your question. I’d like to invite some of our community members with PHP expertise to the conversation — hey @Teun @stefen @skimura [@zach\_threadint](https://community.hubspot.com/t5/user/viewprofilepage/user-id/324811) do you have any suggestions or troubleshooting steps you can recommend to @rsantoro47?

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![rsantoro47](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rsantoro47](https://community.hubspot.com/u/rsantoro47)\
**Post date:** [January 22, 2025, 3:47pm UTC](https://community.hubspot.com/t/creating-a-deal-in-php-using-api-v5-3-0-suddenly-errors-with-deserializationfeature-fail-on-trailing/124313/3 "2025-01-22T15:47:56Z")

</div>

Thank you, any help is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![rsantoro47](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rsantoro47](https://community.hubspot.com/u/rsantoro47)\
**Post date:** [March 15, 2025, 6:34pm UTC](https://community.hubspot.com/t/creating-a-deal-in-php-using-api-v5-3-0-suddenly-errors-with-deserializationfeature-fail-on-trailing/124313/4 "2025-03-15T18:34:33Z")

</div>

I found a workaround for this. It appears that the issue was that I was sending associations along with the create.

If you look at the PHP Classes to create a deal, there is an optional parameter for associations:

public function create(array $properties, array $associations = [])

And the documention indicates ([Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/reference/api/crm/objects/deals/v1#create-a-deal%F0%9F%98%9E)

Example request JSON:  
{  
“associations”: {  
“associatedCompanyIds”: [  
8954037  
],  
“associatedVids”: [  
27136  
]  
},  
“properties”: [  
{  
“value”: “Tim’s Newer Deal”,  
“name”: “dealname”  
},…

I realzie this is the v1.0 API but all of my code has been built around this and it has been working. It is on our product roadmap to update, but it is a big project.

I had formatted the associations array exactly as the above JSON requires, and suddently I started recieving the error message I posted above. This used to work, and no longer does. This leads me to beleive something changed on the Hubspot side, but I could find no documentation.

To get around this, I simply removed the association from the create, then used the seperate classes to create the association after the deal was created. If Hubspot could either fix this on their end, or update the documentation, that would be helpful.
