from BizTalk I have to send an JSON file which looks like this.
[
{
"attr": {
"b587d548-8aa6-42b7-b292-0f3e13452c35": {
"1": "-2.073420455529934786"
}
},
"guid": "80974561-a449-4a94-8b3e-970822b84406",
"anotherGuid": "05060c4c-f0af-46b8-810e-30c0c00a379e",
"lastModified": "2019-11-09T01:44:34.157Z",
"attributes":
{
"4": "2019-11-05T20:30:57.6Z",
"8": "6",
"10": "8",
"13": "7",
"27": "3",
...
},
...
}
]
In a BizTalk Schema I can't define something like this. The Guid in attr and the number attribute names in attributes aren't fix and could be other values.
I have the idea to implement a custom pipeline component which converts the BizTalk XML to Output JSON. But I have no idea how to solve the problem with the names of the Attributes because these are no valid XML names.
What might be the most elegant kind to solve this problem?
Thanks in advance.
UPDATE with more information
To get an JSON like above the XML has to be look like which is invalid
<root>
<element>
<anotherGuid>05060c4c-f0af-46b8-810e-30c0c00a379e</anotherGuid>
<attr>
<b587d548-8aa6-42b7-b292-0f3e13452c35>
<1>-2.073420455529934786</1>
</b587d548-8aa6-42b7-b292-0f3e13452c35>
</attr>
<attributes>
<10>8</10>
<13>7</13>
<27>3</27>
<4>2019-11-05T20:30:57.6Z</4>
<8>6</8>
</attributes>
<guid>80974561-a449-4a94-8b3e-970822b84406</guid>
<lastModified>2019-11-09T01:44:34.157Z</lastModified>
</element>
</root>
To get a valid XML I have to change the invalid elements, i.e. instead of <4 /> maybe <e4 />, <element name="4" /> or something like this. Then a parser (or something else?) has to map this XML element to the correct JSON one.