Json node is missing child properties

I’m trying to batch update contacts using and getting the “Json node is missing child properties” error that other people report around here.

I’m running this request.

response = requests.request("POST", url, data=payload, headers=headers, params=querystring)

I have:

payload = json.dumps(userList)

and userList is this list:

[
	{
		'email': 'a_user@email.com',
		'properties': 
			[
				{
					'property': 'my_field_name',
					'value': 'the_value_for_this_person'
				}
			]
	},
	{
		'email': 'another_user@email.org',
		'properties':
			[
				{
					'property': 'my_field_name',
					'value': 'the_value_for_this_other_person'
				}
			]
	}
]

I keep looking at my braces and brackets convinced I’m missing something somewhere but it looks exactly like the data structure of the sample code to me.

Can someone help?

Are these, like, debug codes here? Useful? :backhand_index_pointing_down:

"correlationId":"2490785a-5bab-4182-823b-f18a860345f3"
"requestId":"c88dab783e5cfd202be8d0a0f7467845

Hey @ddmeyer

It looks like you were wrapping your properties in single quotes which was causing validation issues. Any strings should be wrapped in double quotes.

I’ve gone ahead and updated this now, see below:

{
 "properties": [
 {
 "property": "lifebycyclestage",
 "value": "customer"
 }
 ][
	{
		"email": "a_user@email.com",
		"properties": 
			[
				{
					"property": "my_field_name",
					"value": "the_value_for_this_person"
				}
			]
	},
	{
		"email": "another_user@email.org",
		"properties":
			[
				{
					"property": "my_field_name",
					"value": "the_value_for_this_other_person"
				}
			]
	}
]

I hope this helps!

Thanks for the response here, Matthew. I’m still having trouble.

FWIW, I’m creating the payload programmatically using this code which (I think) means I can’t really control single or double quotes, except around the keys, which are doubles.

def updateHubspot(updateDict, fieldName):
 key = "mykey"
 batchUpdateURL = "https://api.hubapi.com/contacts/v1/contact/batch"
 querystring = {"hapikey": key}
 userList = []

 for key, value in updateDict.items():

 userDict = {}
 userDict["email"] = key

 propertyList = []

 propertyDict = {}
 propertyDict["property"] = fieldName
 propertyDict["value"] = value

 propertyList.append(propertyDict) 
 userDict["properties"] = propertyList
 userList.append(userDict)

 payload = json.dumps(userList)

 headers = {
 'Content-Type': "application/json",
 }

 response = requests.request("POST", url, data=payload, headers=headers, params=querystring)

I also set “userList” to the JSON you sent me, bypassing the script, and got the same error. (You have a “lifecyclebystage” property that I don’t and didn’t see in the documentation. Is that necessary? Maybe that’s my issue.)

{"status":"error","message":"Json node is missing child properties","correlationId":"25a2c106-0926-47a3-8f00-064e6fc21b8c","requestId":"a66dbb9aab67db6dc6b53b2031694bdd"}

Thanks for your help.

Dan

Figured out that I wasn’t using batchUpdateURL in the request. All set now.