Skip to main content
Solved

Saving JSON response to attribute as JSON

  • 11 December 2022
  • 2 replies
  • 140 views

From an API request we get the response:

{
  "records": [
    {
      "id": "recJFKtwINHpI2vAO",
      "createdTime": "2022-12-09T21:30:57.000Z",
      "fields": {
        "id": "4dd9cb87-3571-4fd4-8298-c7bf6e11cb1d",
        "propertyName": "property A",
      }
    },
etc
]
}

When trying to set `testJson` to `{{response.records[0]}}` to an attribute, it comes with these arrow type expressions, which aren’t accessible by customer.testJson[“fields”] or customer.testJson.fields etc.

{“createdTime”=>“2022-12-09T21:30:57.000Z”, “fields”=>{“id”=>“4dd9cb87-3571-4fd4-8298-c7bf6e11cb1d”, “propertyName”=>“property A”}, “id”=>“recJFKtwINHpI2vAO”}

 

I’d like to set the entire response as the testJson, but 1 thing at a time.

I couldn’t find a liquid function to preserve the json.

Best answer by matt

Solved

https://customer.io/docs/webhook-triggered-campaigns/

Need to use `| to_json` . I had tried tojson and json

View original
Did this topic help you find an answer to your question?

2 replies

  • Author
  • Novice
  • 3 replies
  • Answer
  • December 11, 2022

Solved

https://customer.io/docs/webhook-triggered-campaigns/

Need to use `| to_json` . I had tried tojson and json


Customer.io
  • Scholar
  • 11 replies
  • December 12, 2022

Glad you found a workaround here, Matt! Thanks for sharing that.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings