How to iterate over getJsonObject?

Can anyone guide me on this, how can i iterate over Json object in GSQL?

I have Array of dictionaries inside that one dictionary having list nested list of dictionaries, So how can I iterate over that and get (key/value) , various methods are available in docs getString, getInt etc, but I want complete iteration over that.

Hi pkr2,

You can iterate over a list of dictionaries with the FOREACH method.

FOREACH dict IN list DO
  FOREACH (key, value) IN dict DO
    <YOUR CODE HERE>
  END;
END;

More info on FOREACH here:
https://docs.tigergraph.com/gsql-ref/current/querying/control-flow-statements#_foreach_statement

1 Like

hi @Dan_Barkus thanks for your response
this below image is the sub part of my problem

Error: a container type is required while arr.getJsonObject(cnt).getJsonArray(“combinations”) is Json Array

passing parameters : “[ { …} {…}]”