← Prev in month ← Prev in thread

A more natural JSON encoding for originalData

From
Chase Tingley <>
Date
2017-03-13T18:08:49+00:00
ID
Thread
A more natural JSON encoding for originalData
Currently we model originalData as an array of objects that represent an id and a corresponding data item:

        "originalData": [

            { "id": "d1", "data": "[C1/]" },

            { "id": "d2", "data": "[C2]" },

            { "id": "d3", "data": "[/C2]" }

        ],

This is following the XML representation, but originalData is really just a lookup table, a structure XML doesn't handle well.  However, JSON does, so for JLIFF we can use a more natural JSON representation by treating the id value as an object key:

        "originalData": {

            "d1": "[C1/]",

            "d2": "[C2]",

            "d3": "[/C2]"

        },

This is more concise and also easier for a JLIFF consumer to work with.

(Additional note, the value here would need to become an object to support the optional @dir or @xml:space metadata supported in XLIFF.)
← Prev in month ← Prev in thread