How do I sort JSON data?

Get help using Construct 2

Post » Sat Sep 06, 2014 9:48 am

Hello everyone

How can I sort JSON data? I found nice example how json and array for my hight scores?

Example is here:

https ://www.scirra.com/forum/saving-and-loading-an-array-to-webstorage-capx_t68859?sid=c8ae8a3f32ac60d5472e221f968f4d11&start=10
B
3
Posts: 9
Reputation: 193

Post » Sat Sep 06, 2014 10:13 am

I don't think it is possible to sort JSON data straight forward but you can load the JSON data into array, then just sort the array.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Sat Sep 06, 2014 11:13 am

Ok it's done!

RESULT:

pic.png



EDIT: There is a little mistake: this is file for sorting text, if you want numbers, conversion to number (adding int()) must be done
You do not have the required permissions to view the files attached to this post.
B
3
Posts: 9
Reputation: 193


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo, ST314 and 18 guests