Is it possible to create something like this in PHP? I am trying to get around the automatic sorting of numeric indexes when I pick up the JSON object.
Or is it better to use a alphanumeric key to get around this problem?
This:
[
{'key': 5, 'val': 2},
{'key': 2, 'val': 2},
{'key': 1, 'val': 1}
]
Instead of something like this:
[
{1: {'key': 5, 'val': 2}},
{2: {'key': 2, 'val': 2}},
{3: {'key': 1, 'val': 1}}
]