For the complete documentation index, see llms.txt. This page is also available as Markdown.

Merging nested JSON objects

If you have multiple nested JSON Objects (with no duplicate attribute names) like in this example object named Statement:

{
  "Amount": {
    "Currency": "EUR",
    "Value": "10.99"
    },
  "Valuation_Date": {
    "Date": "2022-01-24"
    },
  "References": {
        "FullRef": "CTC123456879",
        "ClearRef": "123456789"
        }
}

You can merge them into a flat one using the following code snipped:

{
  {% for object in [Statement.Amount, Statement.Valuation_Date, Statement.References] %}
    {% for key, value in object.items() %}
      "{{ key }}": "{{ value }}",
    {% endfor %}
  {% endfor %}
}

To receive:

Last updated

Was this helpful?