Liquid Mapping for conversion from xml to json

101 Views Asked by At

I have this xml part of Data:

    <xs:element name="DESCR">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="ADDITIONAL">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="DESCR_CODE">
                  <xs:complexType>
                    <xs:attribute name="CODE" type="xs:unsignedInt" use="required" />
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
      </xs:complexType>
    </xs:element>]

I am interested in mapping this xml to json as:

    "DESCR": {
      "ADDITIONAL": {
        "DESCR_CODE": "{{DESCR.ADDITIONAL.DESCR_CODE.CODE}}"
      }
    }

but I don't get the value of attribute CODE.

How could the value of an XML attribute be mapped to JSON?

0

There are 0 best solutions below