JSon parsing error in worklight

Manoj

We are facing the following issue while parsing the JSON response,

The JSON message which we are getting from the back-end looks as below,

"Envelope": {
      "Body": {
         "mainpgmResponse": {
            "ns": "http:\/\/mainpgm.wsbeans.iseries\/xsd",
            **"return": {**
               "COUNT": "",
               "OBJNAME": "",
               "OPTION": "",
               "OUTPUTY": "",
               "STATUS": ""
            }
         }
      },
      "soapenv": "http:\/\/schemas.xmlsoap.org\/soap\/envelope\/"
   },

We are trying to parse the JSON content as below,

*var webs_data = response.invocationResult.Envelope.Body.mainpgmResponse;

var output = webs_data.return;*

The issue is "return" which is a JavaScript function and hence it is throwing syntax error. We were unable to bye-pass the variable hierarchy.

Your help is much appreciated.

ProGM

why not simply write:

var output = webs_data["return"];

Accessing it in an "assoc array-like" syntax will avoid ambiguity.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related