# Invalid input JSON when using Contacts/Search endpoint

**URL:** <https://community.hubspot.com/t/invalid-input-json-when-using-contacts-search-endpoint/52379>\
**Category:** APIs & Integrations\
**Tags:** php, contacts\
**Created:** [March 1, 2022, 6:31pm UTC](https://community.hubspot.com/t/invalid-input-json-when-using-contacts-search-endpoint/52379 "2022-03-01T18:31:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JNichel](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@JNichel](https://community.hubspot.com/u/JNichel)\
**Post date:** [March 1, 2022, 6:31pm UTC](https://community.hubspot.com/t/invalid-input-json-when-using-contacts-search-endpoint/52379/1 "2022-03-01T18:31:38Z")

</div>

I’m trying to get a list of contacts last modified after a specified time, but I can’t seem to get it right. When I execute the script, I get the error:

`Invalid input JSON on line 1, column 17: Cannot deserialize value of type `java.util.HashSet`from Object value (token`JsonToken.START\_OBJECT`)`

When I test the post data, it returns as valid JSON:

`{"filterGroups":{"filters":{"value":1646144686,"propertyName":"lastmodifieddate","operator":"GT"}}}`

I’ve found a few posts both here and on Stack with similar errors, but no solutions.

My code is as such:

```lia-code-sample
$url = "https://api.hubapi.com/crm/v3/objects/contacts/search";
$api_key = 'xxxxxxxxxxxxxxxxxxxxx';

$range = strtotime("-1 hour");

$data = array(
 "filterGroups" => array(
 "filters" => array(
 "value" => $range,
 "propertyName" => "lastmodifieddate",
 "operator" => "GT"
 )
 )
);

$post = json_encode($data);

$ch = curl_init($url . "?hapikey=" . $api_key);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response));

```

Any help with what I’m doing wrong would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [March 2, 2022, 5:10pm UTC](https://community.hubspot.com/t/invalid-input-json-when-using-contacts-search-endpoint/52379/2 "2022-03-02T17:10:27Z")

</div>

@JNichel ,

Although it is valid JSON, it is not what the API is expecting.

The filtergroup and filter need to be in arrays. Also, the timestamp need to be in milliseconds

```lia-code-sample
{
 "filterGroups":[
 {
 "filters":[
 {
 "propertyName": "lastmodifieddate",
 "operator": "GT",
 "value": 1646240947414
 }
 ]
 }
 ]
}

```

---

<div class="post-metadata">

**Author:** ![JNichel](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@JNichel](https://community.hubspot.com/u/JNichel)\
**Post date:** [March 2, 2022, 8:13pm UTC](https://community.hubspot.com/t/invalid-input-json-when-using-contacts-search-endpoint/52379/3 "2022-03-02T20:13:13Z")

</div>

@dennisedson

Thank you, the milliseconds did the trick. I had created a PHP multi-dimensional array hoping that json\_encode() would convert it into what the API was looking for, but after quite a bit more searching, that doesn’t seem to be the case.
