APIs & Integrations

EPlaza
Membro

Cannot send Array of Objects as a value for a custom event property

resolver

hello, I'm trying to send an array of objects as a value for an event property but I keep getting an error 

"message": "Invalid input JSON on line 1, column 120: Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`)",

this is what i am sending

{
properties:{
checkout_id: 'checkoutid',
total: 129990,
products: [
 {
  value1: 1,
  value2: "value2",
  price: 0,
 },
 {
  value1: 1389368,
  value2: "value2",
  price: 40000,
 },
 {
  value1: 1389369,
  value2: "value2"
  price: 40000,
 },
 {
  value1: 1389375,
  value2: "value2",
  price: 0,
 },
 {
  value1: 1389381,
  value2: "value2",
  price: 49990,
  }
 ],
email: "random.email@gmail.com"
},
eventName: " pe21569360_order_completed"
email: "random.email@gmail.com"
}
0 Avaliação positiva
1 Solução aceita
miljkovicmisa
Solução
Top colaborador(a) | Parceiro Platinum
Top colaborador(a) | Parceiro Platinum

Cannot send Array of Objects as a value for a custom event property

resolver

Hello @EPlaza , hi @Jaycee_Lewis !

Seems like the json object is not formatted properly, try to stick with the double quotes arount keys and values (is strings) and pay attention to your commas.

Here is the corrected partial version of your object as it should be formatted:

{
	"properties": {
		"checkout_id": 12,
		"total": 129990,
		"products": [{
				"value1": 1,
				"value2": "value2",
				"price": 0
			},
			{
				"value1": 1389368,
				"value2": "value2",
				"price": 40000
			}
		],
		"email": "random.email@gmail.com"
	},
	"eventName": " pe21569360_order_completed",
	"email": "random.email@gmail.com"
}


Hope this helps you resolve your issue, also a helpful tool in those situations is a json formatter, because it helps you with debugging the json object. I won't suggest one here but if you do search the google you should find plenty of those.

If my answer was helpful please mark it as a solution.

Exibir solução no post original

0 Avaliação positiva
2 Respostas 2
miljkovicmisa
Solução
Top colaborador(a) | Parceiro Platinum
Top colaborador(a) | Parceiro Platinum

Cannot send Array of Objects as a value for a custom event property

resolver

Hello @EPlaza , hi @Jaycee_Lewis !

Seems like the json object is not formatted properly, try to stick with the double quotes arount keys and values (is strings) and pay attention to your commas.

Here is the corrected partial version of your object as it should be formatted:

{
	"properties": {
		"checkout_id": 12,
		"total": 129990,
		"products": [{
				"value1": 1,
				"value2": "value2",
				"price": 0
			},
			{
				"value1": 1389368,
				"value2": "value2",
				"price": 40000
			}
		],
		"email": "random.email@gmail.com"
	},
	"eventName": " pe21569360_order_completed",
	"email": "random.email@gmail.com"
}


Hope this helps you resolve your issue, also a helpful tool in those situations is a json formatter, because it helps you with debugging the json object. I won't suggest one here but if you do search the google you should find plenty of those.

If my answer was helpful please mark it as a solution.

0 Avaliação positiva
Jaycee_Lewis
Gerente da Comunidade
Gerente da Comunidade

Cannot send Array of Objects as a value for a custom event property

resolver

Hi, @EPlaza 👋 Thanks for reaching out and including those details. Hey, @Teun @miljkovicmisa, do you have any experience or troubleshooting tips you can share here? Thank you for taking a look! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Avaliação positiva