JSONSelect and JSON_GetAttributes

JSONSelect and JSON_GetAttributes

  
Hi,

does anyone have a sample on how to use these new functions? I'm actually thinking that this function is what I need for my current predicament but I'm not sure how this works. 

Thanks,
Ron
Hello,

Sorry for taking so long to answer, but I didn't notice the question here on the forum. If you want to ask a question about a specific component, you should use the discussion forums for that component as that'll alert at least the author :)

In any case, can you please elaborate on your predicament?

I would like to note that JSONSelect is not that new. It's been in ardoJSON almost from the beggining, although it has been recently changed a bit to a form that feels more useful.

There's nothing like experimenting a bit with the functions to evaluate if they fit the purpose you need, but here's a rundown of what they do. Imagine you have the following JSON:

{
 "one": 1,
  "two": 2,
 "three": 3
}

If you JSONSelect(JSON, "one") you'll get 1

If you JSON_GetAttributes this JSON, you'll get a list with name / value pairs for the properties of this specific object:

[
{ name: "one", value: "1" },
{ name: "two", value: "2" },
{ name: "three", value: "3" }
]

This last one allows you to dynamically introspect JSON in your OutSystems Code.

Please let me know if these examples helped clarify what the functions do or if you need further clarification.

Best regards,
Ricardo Silva