Render: Ensure lists are sorted by key

Although maps are already sorted by key as part of the JSON
serialization, lists contianing a field that acts as a key (e.g.
"index") were not sorted. As a result, the HAL object returned from
_hal() would have an arbitrary ordering that depended on the internal
representation of the originating map, which would often differ from run
to run. As a result, test_a03 would usually fail, since the expected
result had embedded objects appearing in a different order to that in
which they were expected.

We now do a sort on the embedded objects as well as the key list before
returning the object, to ensure the same result is returned every time.