In JSON, the order of fields in an object is unspecified. In order to preserve the order of Statements, Qualifiers, References, etc, we need to represent it explicitly in the JSON output. One way is to give each element an index field. Another way is to have a special member in the associative map that is just a list of keys, giving their order.
Description
Description
| Status | Subtype | Assigned | Task | |
|---|---|---|---|---|
| · · · | ||||
| Resolved | Lydia_Pintscher | T73170 [Story] Ensure feature parity of serialization based on WikibaseDataModelSerialization with what we do with WikibaseLib | ||
| Invalid | None | T98861 [Task] DataModelSerialization: represent map order in JSON output | ||
| · · · |
Event Timeline
Comment Actions
This blocks "WikibaseDataModelSerialization with what we do with WikibaseLib" and although we have totally removed the Lib Serialization I would not consider this task complete in regards to WikibaseDataModelSerialization..
Right now we are doing the "Another way is to have a special member in the associative map that is just a list of keys, giving their order." one so I guess we should probably just keep doing that!
Comment Actions
Python has OrderedDict, but I haven't heard of any way for JavaScript's JSON.parse() to use [[ //developer.mozilla.org/it/docs/Web/JavaScript/Reference/Global_Objects/Map | Map ]] instead of Object.
Separate keys like qualifiers-order look like the safest workaround as of now.