# got Invalid input JSON Error

**URL:** <https://community.hubspot.com/t/got-invalid-input-json-error/20638>\
**Category:** APIs & Integrations\
**Tags:** workflows, developer-tools\
**Created:** [May 6, 2020, 1:23pm UTC](https://community.hubspot.com/t/got-invalid-input-json-error/20638 "2020-05-06T13:23:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krotons](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/krotons/32/84335_2.png) [@krotons](https://community.hubspot.com/u/krotons)\
**Post date:** [May 6, 2020, 1:23pm UTC](https://community.hubspot.com/t/got-invalid-input-json-error/20638/1 "2020-05-06T13:23:20Z")

</div>

Invalid input JSON on line 1, column 1: Cannot deserialize instance of `java.util.ArrayList` out of START\_OBJECT token

my code:

```auto
from hubspot3 import Hubspot3

def sync_product(self): 
 conn = self.env['hubspot.connection'].search([])
 api_key = conn.api_key
 client = Hubspot3(api_key=api_key)
 data = {
 "properties": [
 {
 "name": "name",
 "value": self.display_name or " "
 },
 {
 "name": "description",
 "value": self.description or " "
 },
 {
 "name": "price",
 "value": self.standard_price or " "
 },
 {
 "name": "recurringbillingfrequency",
 "value": "quarterly"
 }
 ]
 }
 product = client.products.create(data)

```

what’s wrong with this i got warning like

hub root: Too many retries for /crm-objects/v1/objects/products?hapikey=92…

also:

Invalid input JSON on line 1, column 1: Cannot deserialize instance of `java.util.ArrayList` out of START\_OBJECT token

---- request ----  
POST [api.hubapi.com/crm-objects/v1/objects/products?hapikey=9274](http://api.hubapi.com/crm-objects/v1/objects/products?hapikey=9274)\*\*\*\*, [timeout=\<class ‘int’\>]

---- body ----  
\<class ‘NoneType’\>

---- headers ----  
\<class ‘dict’\>

---- result ----  
\<class ‘int’\>

---- body -----  
{“status”:“error”,“message”:“Invalid input JSON on line 1, column 1: Cannot deserialize instance of `java.util.ArrayList` out of START\_OBJECT token”,“correlationId”:“88ea35f6-43c5-421a-9684-8a3fbee08532”,“requestId”:“24dcbdef-d951-4092-868d-48e7d86bf0ed”}

---- headers -----  
\<class ‘http.client.HTTPMessage’\>

---- reason ----  
Bad Request

---- trigger error ----  
\<class ‘NoneType’\>

i have successfully connection with api i didn’t get any error with api connection.

please help.

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [May 7, 2020, 2:10pm UTC](https://community.hubspot.com/t/got-invalid-input-json-error/20638/2 "2020-05-07T14:10:34Z")

</div>

Hi, @krotons.

The [v1 Products API](https://developers.hubspot.com/docs/methods/products/create-product) expects a single array in the payload. Here’s the example from the documentation:

```auto
[
 {
 "name": "name",
 "value": "A new product"
 },
 {
 "name": "description",
 "value": "A description of this product."
 },
 {
 "name": "price",
 "value": "27.50"
 },
 {
 "name": "recurringbillingfrequency",
 "value": "quarterly"
 }
]

```

If you remove the `{}` and the `"properties":` key, you should receive a successful response.

---

<div class="post-metadata">

**Author:** ![AShaikh8](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@AShaikh8](https://community.hubspot.com/u/AShaikh8)\
**Post date:** [March 10, 2022, 6:25am UTC](https://community.hubspot.com/t/got-invalid-input-json-error/20638/3 "2022-03-10T06:25:13Z")

</div>

Hi I am too facing the same error  
“Invalid input JSON on line 1, column 132: Cannot deserialize value of type `java.util.ArrayList` from Object value (token `JsonToken.START_OBJECT`)”  
Where I am passing the json through curl request below is the following json  
{  
“name”: “DEMO\_NAME”,  
“label”: “Demo Property”,  
“type”: “enumeration”,  
“field\_type”: “select”,  
“group\_name”: “contactinformation”,  
“options”: {  
“label”: “Danzig”,  
“value”: “Danzig”  
},  
“display\_order”: 2,  
“has\_unique\_value”: false,  
“hidden”: false,  
“form\_field”: true  
}  
and this is my curl request code

$ch = @curl\_init();

@curl\_setopt($ch, CURLOPT\_POST, true);  
@curl\_setopt($ch, CURLOPT\_POSTFIELDS, $json);  
@curl\_setopt($ch, CURLOPT\_URL, $endpoint);  
@curl\_setopt($ch, CURLOPT\_HTTPHEADER, array(  
‘Content-Type: application/json’  
));  
@curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);  
$response = @curl\_exec($ch);  
print\_r($response);  
exit;  
$status\_code = @curl\_getinfo($ch, CURLINFO\_HTTP\_CODE);  
$curl\_errors = curl\_error($ch);  
@curl\_close($ch);  
echo “\<br\>”;

print\_r($response);  
if($response)  
{  
echo “Property Created”;  
echo “\<br\>”;  
return $response . "  
";  
$result = file\_get\_contents($response);  
var\_dump(json\_decode($result, true));  
}  
echo “\<br\>”;

}

Please help me out in this with a helpful solution

---

<div class="post-metadata">

**Author:** ![ms19](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@ms19](https://community.hubspot.com/u/ms19)\
**Post date:** [October 17, 2023, 12:54pm UTC](https://community.hubspot.com/t/got-invalid-input-json-error/20638/4 "2023-10-17T12:54:23Z")

</div>

i’ve same problem in php?

{“status”:“error”,“message”:“Invalid input JSON on line 1, column 1: Cannot deserialize value of type `com.hubspot.inbounddb.publicobject.core.v2.SimplePublicObjectInputForCreate$Json` from Array value (token `JsonToken.START_ARRAY`)”,“correlationId”:“b292d6c5-55a4-4d5f-b386-875453f88bf1”}

` `

here is my code:

\<?php

if ($\_SERVER[“REQUEST\_METHOD”] == “POST”) {

// Check if the ‘name’, ‘email’, and ‘phone’ keys exist in the $\_POST array

if (isset($\_POST[“name”]) && isset($\_POST[“email”]) && isset($\_POST[“phone”])) {

// Retrieve form data

$name = $\_POST[“name”];

$email = $\_POST[“email”];

$phone = $\_POST[“phone”];

// Perform any validation or processing here

// Prepare data to be sent to the API

$data = array(

[

[‘name’ =\> ‘name’, ‘value’ =\> $name],

[‘name’ =\> ‘email’, ‘value’ =\> $email],

[‘name’ =\> ‘phone’, ‘value’ =\> $phone]

]

);

$data\_string = json\_encode($data);

// API URL

$api\_url = ‘[https://api.hubapi.com/crm/v3/objects/contacts](https://api.hubapi.com/crm/v3/objects/contacts)’;

$access\_token = ‘pat-na1-7618b06c-b2ad-4cd6-9c41-55efa0116a38’; // Replace with your actual access token

$ch = curl\_init($api\_url);

curl\_setopt($ch, CURLOPT\_CUSTOMREQUEST, “POST”);

curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data\_string);

curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);

curl\_setopt($ch, CURLOPT\_HTTPHEADER, array(

‘Content-Type: application/json’,

'authorization: Bearer ’ . $access\_token

));

$response = curl\_exec($ch);

if (curl\_errno($ch)) {

echo 'Error: ’ . curl\_error($ch);

} else {

// Process the API response here (e.g., display or save it)

echo “API Response: \<pre\>” . $response . “\</pre\>”;

}

curl\_close($ch);

} else {

// Handle the case where one or more form fields are missing

echo “One or more form fields are missing.”;

}

} else {

// Handle the case where the page is first loaded

// You can optionally display the form here

}

?\>

\<!DOCTYPE html\>

\<html\>

\<head\>

\<title\>Contact Form\</title\>

\<!-- Include Bootstrap CSS from a CDN --\>

\<link href=“[https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css](https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css)” rel=“stylesheet”\>

\</head\>

\<body\>

\<section\>

\<h2 class=“text-center”\>Contact Form\</h2\>

\<form method=“post” action=“contacts.php” class=“container”\>

\<div class=“mb-3”\>

\<label for=“name” class=“form-label”\>Name:\</label\>

\<input type=“text” name=“name” class=“form-control” required\>

\</div\>

\<div class=“mb-3”\>

\<label for=“email” class=“form-label”\>Email:\</label\>

\<input type=“email” name=“email” class=“form-control” required\>

\</div\>

\<div class=“mb-3”\>

\<label for=“phone” class=“form-label”\>Phone:\</label\>

\<input type=“tel” name=“phone” class=“form-control” required\>

\</div\>

\<div class=“text-center”\>

\<button type=“submit” value=“submit” name=“submit” class=“btn btn-primary”\>Submit\</button\>

\</div\>

\</form\>

\<!-- Include Bootstrap JavaScript and jQuery if needed --\>

\<script src=“[https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js](https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js)”\>\</script\>

\<script src=“[https://code.jquery.com/jquery-3.6.0.min.js](https://code.jquery.com/jquery-3.6.0.min.js)”\>\</script\>

\</body\>

\</html\>
