Traverse on json object - Forum

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

Traverse on json object

Hi,

How can we traverse on the "object properties" inside VisualNEO Web?

like below:

https://www.w3schools.com/js/tryit.asp?filename=tryjson_object_loop

 

Hi @asmat,

That's not available in current version but I will include it in the next one.
The code will be like this:

CreateEmptyObject [myobj]
SetVar [myobj.name] "Peter"
SetVar [myobj.age] 34
SetVar [myobj.car] "Seat"
LoopObject [x] [myobj]
  GetObjectHTML "Container1" [content]
  SetObjectHTML "Container1" "[content][x]<br>"
EndLoop

Meanwhile you can use something like this:

CreateEmptyObject [myobj]
SetVar [myobj.name] "Peter"
SetVar [myobj.age] 34
SetVar [myobj.car] "Seat"
BeginJS
   for($App.x in $App.myobj){
      content=$("#Container1").html()
      $("#Container1").html(content+$App.x+"<br>");
   }
EndJS

 

Please let me know if you miss any other JavaScript command in VisualNEO Web actions.
Thank you!