I am a complete newcomer to Liquid, started playing with it a few hours ago.
i am trying to parse a JSON and extract certain key value pairs out of it, yet i am not successful at all. the JSON is outputed from Azure Form Recognizer, and i am trying to do a Liquid json 2 json in Logic Apps.
the JSON looks like this
{
"status": "success",
"pages": [
{
"number": 1,
"keyValuePairs": [
{
"key": [
{
"text": "Page No:",
"boundingBox": [
507.4
]
}
],
"value": [
{
"text": "1",
"boundingBox": [
586.8
],
"confidence": 1.0
}
]
},
....
...
what i am looking for is to loop through the keyValuePairs array, and then pull the "text" element from the "key" array, and the "text"+"confidence" element from the "value"array.
Could you please help me in understanding the approach here? I tried something like this, but the array comes back empty
{
"results":[
{% for kvp in content.keyValuePairs %}
{% for mykey in kvp.key %}
"thiskey":"{{mykey.text}}
{%- endfor -%}
{% for myval in kvp.value %}
"thisvalue":{{myval.text}}
"thisconfidence":{{myval.confidence}}
{%- endfor -%}
{%- endfor -%}
]
}
And second question: what's the best approach for debugging Liquid, so i can see where i am getting it wrong and adjust?
Thank you!