04-12-2016 11:53 PM
Hello all
I need help reordering Data I get from an Unflatten from JSON.
I have a JSON string from an API call (from unflatten from JSON) that contains a name (string), a numeric, and a Channel (also a string).
The Unflatten from JSON automatically orders the data it receives in the order the data is provided. The data is information about channels. The problem arises when not all channels are provided. If out of 12 channels, the JSON receives information on only 4 channels, it orders them 1 through 4 in the array. However, 1 may not correspond to channel 1 and may in actuality be channel 5 and 3 may not correspond to channel 3 so on and so forth. I would like to reorder the JSON based on the channel reading (a string named Channel). So if in the array Channel 4 is actually 12 (based on string channel, i.e. Channel-12), I would like to connect Channel 4 data into channel 12 in a new array so that the ordering of the channels remains dependent on the channel string and not based on the order from unflatten from JSON.
Please help as I am out of ideas on how to solve this.
Thank you.
Solved! Go to Solution.
04-13-2016 02:57 AM
Is this what you ment?
PS: Try to avoid mutliple index array - it's better to use arrays and for loops;)
04-13-2016 03:19 AM
Thank you Adam