I've been working on a workflow in Azure Logic apps, which receives an XML file which I then convert to JSON using json(xml(variables('xmldocument')))
and then I put it in ParseJSON function to which I give the converted JSON as a sample payload to generate the schema.
The problem is that I have some timeseries in the file, almost all of them containing many objects. But in the end, there is one timeseries containing only one object. And it creates the problem because the timeseries is treated as an array of objects but the last timeseries ins only one object, no array, and then there is always an error when parsing the JSON.
Here is a sample of the file:
<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="blank">
<mRID>9</mRID>
<schedule_Time_Period.timeInterval>
<start>2020-03-20T23:00Z</start>
<end>2020-03-21T23:00Z</end>
</schedule_Time_Period.timeInterval>
<TimeSeries>
<mRID>c</mRID>
<businessType>B</businessType>
<Period>
<timeInterval>
<start>2020-03-20T23:00Z</start>
<end>2020-03-21T23:00Z</end>
</timeInterval>
<resolution>P</resolution>
<Point>
<position>1</position>
<quantity>2</quantity>
</Point>
<Point>
<position>2</position>
<quantity>2</quantity>
</Point>
</Period>
</TimeSeries>
<TimeSeries>
<mRID>56</mRID>
<version>1</version>
<businessType>A</businessType>
<Period>
<timeInterval>
<start>2020-03-20T23:00Z</start>
<end>2020-03-21T23:00Z</end>
</timeInterval>
<resolution>P1D</resolution>
<Point>
<position>1</position>
<quantity>1.0652</quantity>
</Point>
</Period>
</TimeSeries>
</Document>
Do you have any idea how to deal with it? Thanks for helping me!