Message82864
Same reason as for config files and yaml files. Sometimes those files
represent human edited input and if a machine re-edits, filters, or
copies, it is nice to keep the original order (though it may make no
semantic difference to the computer).
For example, jsonrpc method invocations are done with objects having
three properties (method, params, id). The machine doesn't care about
the order of the properties but a human reader prefers the order listed:
--> {"method": "postMessage", "params": ["Hello all!"], "id": 99}
<-- {"result": 1, "error": null, "id": 99}
If you're testing a program that filters json data (like a typical xml
task), it is nice to write-out data in the same order received (failing
to do that is a common complaint about misdesigned xml filters):
--> {{"title": "awk", "author":"aho", "isbn":"123456789X"},
{"title": "taocp", "author":"knuth", "isbn":"987654321X"}"
<-- {{"title": "awk", "author":"aho"},
{"title": "taocp", "author":"knuth"}}
Semantically, those entries can be scrambled; however, someone reading
the filtered result desires that the input and output visually
correspond as much as possible. An object_pairs_hook makes this possible. |
|
Date |
User |
Action |
Args |
2009-02-27 19:59:13 | rhettinger | set | recipients:
+ rhettinger, bob.ippolito |
2009-02-27 19:59:13 | rhettinger | set | messageid: <1235764753.78.0.473123474274.issue5381@psf.upfronthosting.co.za> |
2009-02-27 19:59:12 | rhettinger | link | issue5381 messages |
2009-02-27 19:59:10 | rhettinger | create | |
|