Hello
Is there a way to get a Json Map in the order it was put into. It's not really an issue, but for API browsers and documentation it's nicer to return Json results (and errors following RFC 7807) in the order people expect.
Consider this code:
Will return this:
I could write a reverse function, but maybe an 'Add' function on a Map instead of 'Put' would be more graceful?
Thanks
Is there a way to get a Json Map in the order it was put into. It's not really an issue, but for API browsers and documentation it's nicer to return Json results (and errors following RFC 7807) in the order people expect.
Consider this code:
B4X:
Dim m As Map
m.Initialize
m.Put("first", "testvalue")
m.Put("last", "testvalue")
Dim j As JSONGenerator
j.Initialize(m)
Log(j.ToPrettyString(4))
Will return this:
{
"last": "testvalue",
"first": "testvalue"
}
I could write a reverse function, but maybe an 'Add' function on a Map instead of 'Put' would be more graceful?
Thanks