The CreatorCon Call for Content is officially open! Get started here.

Incorrect JSON Path

cspra
Giga Expert

Hi,

How can I extract this "text":"nzur12345uap.XYZPROD.MSAD.XYZ.NET"?

Evaluator: com.glide.script.RhinoEcmaError: Cannot read property "0" from undefined
   script : Line(33) column(0)

==>  33:   gs.print(respJObj.data.result_sets[0].rows[0].data[2]);
 {
   "data":{
      "now":"2022/02/15 16:50:48 GMT-0000",
      "max_available_age":"",
      "result_sets":[
         {
            "age":0,
            "id":296900,
            "rows":[
               {
                  "id":1059534335,
                  "cid":3331268787,
                  "data":[
                     [
                        {
                           "text":"nzur12345uap.XYZPROD.MSAD.XYZ.NET"
                        }
                     ],
                     [
                        {
                           "text":"Windows Server 2016 Standard"
                        }
                     ],
                     [
                        {
                           "text":"1"
                        }
                     ]
                  ]
               }
            ]
         }
      ]
   }
}

Thanks

1 ACCEPTED SOLUTION

Dan H
Tera Guru

Hi, heres an example:

 

gs.log(respJObj.data.result_sets[0].rows[0].data[0][0].text);
 
If this has helped or solved your question please mark it as so!

View solution in original post

6 REPLIES 6

Sukraj Raikhraj
Kilo Sage

Put the JSON string in a JSON parser, look like there is another object after data. 

find_real_file.png

Thanks, but would you mind explaning programmatically?

Dan H
Tera Guru

Hi, heres an example:

 

gs.log(respJObj.data.result_sets[0].rows[0].data[0][0].text);
 
If this has helped or solved your question please mark it as so!

Thanks @hennessyD but that doesn't work.

Evaluator: com.glide.script.RhinoEcmaError: Cannot read property "0" from undefined
   script : Line(35) column(0)
==>  35: gs.print(respJObj.data.result_sets[0].rows[0].data[0][0].text)