1

I am very new to this Azure Liquid templates. I'm parsing JSON to JSON using Dot Liquid.

I have "userDefinedFields" under "data" is an array of 4 fields i.e., Reason, Number, Bill and Key. In JSON, sometimes "userDefinedFields" may have 4 fields or 3 fields or 2 fields. I have to get all the 4 fields (Reason, Number, Bill and Key) from "userDefinedFields" and rest fields from "data" as an output of Liquid transformation:

    id
    newID
    userDefinedFields : 
        if name=="Reason", get the value
        if name=="Number", get the value
        if name=="Bill", get the value
        if name=="Key", get the value

I want Liquid template code to pick all the 4 fields together as one set (whether it has null value or proper value).

What can I try next?

halfer
  • 19,824
  • 17
  • 99
  • 186
timz_123
  • 435
  • 1
  • 9
  • 47
  • Do you really need to use liquid? What if you could do it through standard expressions? If you paste in an example source JSON and how you want it to be in the destination JSON, I’m sure we can avoid liquid. – Skin Jan 09 '23 at 08:51
  • I have achieved the desired result using liquid. But I am still stuck at one place where in liquid when I use if condition to check the userDefinedFields, if name=="Reason" ; its value is "abc/"xyz"". I want to fetch above value like "abc/xyz" as an output of liquid but bcoz the value I am getting is value is "abc/"xyz"", I get an error IncorrectLiquidTransformOutputType. Could you please help me with fixing this ? – timz_123 Jan 09 '23 at 12:54
  • You need to show your json and illustrate the issue. So change your question. – Skin Jan 09 '23 at 18:00

0 Answers0