ijprest / keyboard-layout-editor

Web application to enable the design & editing of keyboard layouts
http://www.keyboard-layout-editor.com/
Other
1.3k stars 241 forks source link

Why the json output is so bad? #287

Closed skarone closed 4 years ago

skarone commented 4 years ago

The current json structure is not friendly at all.. One key uses previous key information with some offset.. Is this to save space in a 3k file?? Is there a logic behind this?

ijprest commented 4 years ago

It's the result of incremental development.

The first version of the site didn't have any editor controls, so the JSON was all hand-typed; the current format avoided having to repeat yourself excessively for successive keys that shared all their properties (except for the text/label).

Also, earlier versions of the site had no ability to "save" the layout... if you wanted to send someone a link to your layout, it was entirely contained within the URL. So yes, saving space in that case was important. (Some browsers at the time wouldn't even allow links greater than 1-2k.)

FYI, if you want to deserialize the JSON to something more appropriate for consumption in another app you're writing, the deserialization logic has been factored out into a separate library here: https://github.com/ijprest/kle-serial