cancel
Showing results for 
Search instead for 
Did you mean: 

Square brackets issue xml to json conversion for one row

0 Kudos
976

Hi Everyone,

I have BLS that converting a sql query results to json output. Everything working fine with multiple rows.

But if the query returns only one row in the results, json array Square brackets are not being generated. As you can see samples below. So the binding path of json model is changing in our ui5 application. I'm looking for a workaround.

Thank you.

Results For two row:

{

  • Rowsets: {
    • @CachedTime: "",
    • @DateCreated: "2019-07-26T13:45:44",
    • @EndDate: "2019-07-26T13:45:44",
    • @StartDate: "2019-07-26T12:45:44",
    • @Version: "15.1 SP6 Patch 35 (Mar 22, 2019)",
    • Rowset: {
      • Columns: {},
      • Row: [
        • {
          • DRSDTYID: 19101098,
          • DTEBASTARIH: "2019-07-26T13:11:17",
          • DTEBITTARIH: "2019-07-26T13:30:34",
          • SURE: 1157,
          • SRMISYERI: "None"

          },

        • {
          • DRSDTYID: 19101095,
          • DTEBASTARIH: "2019-07-26T12:35:47",
          • DTEBITTARIH: "2019-07-26T12:45:06",
          • SURE: 559,
          • SRMISYERI: "None"

          }

        ]

      }

    }

}

Results For One Row:

{

  • Rowsets: {
    • @CachedTime: "",
    • @DateCreated: "2019-07-26T13:49:12",
    • @EndDate: "2019-07-26T13:49:12",
    • @StartDate: "2019-07-26T12:49:12",
    • @Version: "15.1 SP6 Patch 35 (Mar 22, 2019)",
    • Rowset: {
      • Columns: {},
      • Row: {
        • DRSDTYID: 19101098,
        • DTEBASTARIH: "2019-07-26T13:11:17",
        • DTEBITTARIH: "2019-07-26T13:30:34",
        • SURE: 1157,
        • SRMISYERI: "None"

        }

      }

    }

}

View Entire Topic
former_member185280
Active Contributor

What are you using to do the conversion? If you are using the XML to Json Converter Action you may have issues because it is meant as a generic conversion and not specifically for the MII Rowset format. The conversion engine has no way to know if an xml node is meant to be an array or not unless it finds more than one duplicate child node/record.

I typically keep things within the bls engine xml and wrap my transactions with an Xacute query to do the conversion to json when calling from the front end. The downside of this is that you have to have your output in the Rowsets format but the upside is that you will always get the correct json format.

Regards,
Christian

0 Kudos

Xacute query solved my problem. Thank you.