Next in thread → Next in month →

Re: A more natural JSON encoding for originalData

From
Chase Tingley <>
Date
2017-03-13T18:22:41+00:00
ID
CAHPP-oHfosBWHfGyaZ2GO3nC6HgG0ar_9HF4e1=
Thread
Re: A more natural JSON encoding for originalData
I've opened a pull request containing these changes.  Robert, if you agree with this, go ahead and merge it.

On Mon, Mar 13, 2017 at 11:08 AM, Chase Tingley <> wrote:

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.)
Next in thread → Next in month →