APIs & Integrations

EPlaza
メンバー

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

解決

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 いいね!
1件の承認済みベストアンサー
miljkovicmisa
解決策
トップ投稿者 | Platinum Partner
トップ投稿者 | Platinum Partner

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

解決

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 いいね!
2件の返信
miljkovicmisa
解決策
トップ投稿者 | Platinum Partner
トップ投稿者 | Platinum Partner

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

解決

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 いいね!
Jaycee_Lewis
コミュニティーマネージャー
コミュニティーマネージャー

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

解決

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 いいね!