This topic contains 5 replies, has 2 voices, and was last updated by Eliot Muir 9 years, 1 month ago.
Alphabetically sorted JSON
You must be logged in to reply to this topic.
This topic contains 5 replies, has 2 voices, and was last updated by Eliot Muir 9 years, 1 month ago.
Little requirement came up from a partner wanting to have the keys in their JSON alphabetically sorted.
So we’ve added an optional ‘alphasort’ parameter to json.serialize.
This is a fragment of code you can use to test the new option (incidentally it will appear in Iguana 5.6.5):
local T = {c='life', b='smith', a='jim'}
local J = json.serialize{data=T,alphasort=true, compact=false}
Here’s a screenshot showing it in action.
This is great, Eliot. I had one of my team members mention recently that the JSON presentation could be ordered in a way that would make it easier to find elements, and alphabetically sorting it is a big improvement. Thanks!
Jeff Drumm ◊ VP and COO ◊ HICG, LLC. ◊ http://www.hicgrp.com
You must be logged in to reply to this topic.