Dear community

I'm struggling with transforming some xml data into a json format using an
avro schema.
The data which I can't get to work looks something like this:
<object>
    <objectDetails>
        <additionalInfo name="tag1">value1</additionalInfo>
        <additionalInfo name="tag2">value2</additionalInfo>
        <additionalInfo name="tag3">value3</additionalInfo>
    </objectDetails>
    <objectIdentification>
        <objectId>1</objectId>
        <objectType>objType</objectType>
    </objectIdentification>
</object>

If I set the type for additionalInfo to array, I only gets the values. I
tried to set the array items to a record. But I can't get the tag names.

My goal is to get a json like this:
"object" : {
    "objectDetails" : [
        { "additionalInfo" : "tag1", "value":"value1"}
        { "additionalInfo" : "tag2", "value":"value2"}
        { "additionalInfo" : "tag3", "value":"value3"}
    ],
    "objectIdentification" : {
      "objectId" : 1,
      "objectType" : " objType  "
    }
  }

or

"object" : {
    "objectDetails" : {
        "additionalInfo" : [
             {"name":"tag1", "value":"value1"},
             { "name":"tag2", "value":"value2"},
             { "name":"tag3", "value":"value3"}
        ]
    },
    "objectIdentification" : {
      "objectId" : 1,
      "objectType" : " objType  "
    }
  }

Kind regards
Jens M. Kofoed

Reply via email to