Accessing JSON Object not working

Vinicius Luz
Tera Expert

Hello guys, can you notice something wrong in this script? It is returning a string and when I try to access it in the client side, even parsing with JSON.parse, I cannot access the obj elements...

Script include:

 

find_real_file.png

OnChange client script:

find_real_file.png

1 ACCEPTED SOLUTION

-O-
Kilo Patron
Kilo Patron

response.getBody() returns a string, so you shouldn't "stringify" it - it is already a string.

An advice, if you allow me: post text, not pictures.

Someone might want to test your code, should that person re-type what you already have? How many do you thing would go the length?

View solution in original post

6 REPLIES 6

In code answerParsed is obtained from response which is intended to be the stringification of an object, so it is OK.

What needs to be changed is the Script Include where the value obtained by calling response.getBody() should be returned.

You're right. Script include code didn't show up on my browser when I first looked at the question.