Question

How to access JSON objects on relationship attributes

  • 23 October 2023
  • 4 replies
  • 91 views

When using customer attributes, we can have attribute that contains a JSON object and we can simply use them like so `{{ customer.my_json.my_property }}``.

 

I tried to do the same for a JSON object stored on a custom object accessed via a relationship:

`{{ objects.my_objects[0].my_json.my_property }}`. I get the following error: “Variable 'my_json.my_property is missing”.
Even though my `my_json` object is `{ “my_property”: “hello world” }`.

 

I’m suspecting that in relationships, JSON objects aren’t parsed automatically. If this is the case, how can I parse them?


4 replies

Userlevel 2

Hello,

 

This is Byron from the technical support team. It looks like you caught this issue just a little before we released a fix earlier in the day.

 

To test, I added an attribute to one of my Companies objects to match your example and was able to confirm that the liquid you were testing with earlier works now.

 

Please give it another try and let us know if you continue to see an error.

Hi,

 

I just tried and I still get the error.
Here’s the attribute I have in my “trainings” object:

I use it like this:

And I get this error:

 

FYI, this attribute is set using a Postgre Reverse ETL. I don’t know if that matters.

Userlevel 2

Hello,

 

I set up a matching example and was able to render the variable from the object.

 

One issue I ran into while testing is that I was editing the object in one browser tab and had the editor open in a second tab. After saving the object data, I did receive the variable missing error that you saw until I refreshed the page. So, I believe you may have a similar sync issue between tabs. Could you be sure that the data is saved on the object, that the editor page is refreshed, and that you have a profile pulled up in the sample data section of the editor that matches the liquid condition so that it can render?

I didn’t edit the attribute from customer.io UI, the data is coming from a Postgre Reverse ETL.

Reply