Page MenuHomePhabricator

[Task] DataModelSerialization: represent map order in JSON output
Closed, InvalidPublic

Description

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.

Event Timeline

daniel raised the priority of this task from to High.
daniel updated the task description. (Show Details)
JanZerebecki lowered the priority of this task from High to Medium.May 16 2015, 5:19 PM
JanZerebecki set Security to None.

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!

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.

Jonas renamed this task from DataModelSerialization: represent map order in JSON output to [Task] DataModelSerialization: represent map order in JSON output.Aug 15 2015, 12:21 PM