ParseJSON - Not Working - Page 2 - Forum

Forum Navigation
You need to log in to create posts and topics.

ParseJSON - Not Working

PreviousPage 2 of 2

Hi @alexander_loc

Before you show in text object or container a variable structured like [variable(x).filed] make sure you have passed the contains into a new variable wih Setvar.

SetVar "[newvar] "[variable(x).filed]"

The array comes in [data]
But in SetVar [id] [array Data(0).id] is the undefined value

CreateEmptyArray [arrayData]
SetVar [arrayData] [data]
SetVar [id] [arrayData(0).id]
SetObjectHTML "Container1" "[arrayData]" // {"id":"1","login":"qwerty","password":"pass-qwer","email":"qwer@qwe.qw"}{"id":"2","login":"qwerty","password":"pass-qwer","email":"qwer@qwe.qw"}
ConsoleLog [id]  // - undefined

 

When you have a variable in array but inside the var is empty (without data) if that variable is not declared before u get underfined. So if you are not sure if your variables are going to be filled with data make sure you declared before the array with setvar [var] "" to bypass the underfined.

Declared a variable, but after loading the data, it takes the value undefined again.

what else could be the reason?

@alexander_loc

Please try this

CreateEmptyArray [arrayData]
SetVar [arrayData] [data]
SetVar [index] 0
SetVar [id] [arrayData([index]).id]
and if is not working w8 for Lui to see it..

Thank you for your help, the issue has been resolved in this topic

YASIN and smartmedia have reacted to this post.
YASINsmartmedia
PreviousPage 2 of 2