How to iterate through JSON variable?

I have a JSON reply that looks like this: [26, 27, 28] or it could be a single element e.g. [25].

I would like to iterate through this JSON reply, and depending on its number of elements in the list do different actions i.e. print the length of the list, use "-" to separate the elements instead of commas etc. Any ideas how to do this?

1
10 replies