ijprest / keyboard-layout-editor

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

proposal — JSON schema #254

Closed chiboreache closed 5 years ago

chiboreache commented 5 years ago

How can I parse that !?

[
  [
    {
      "w": 1.5
    },
    "Esc",
    {
      "x": 0.5
    },
    "F1"
  ]
]

just don't get it…

Here is my proposal:

[
  [
    {
      "key": "Esc",
      "width": 1.5
    },
    {
      "key": null,
      "width": 0.5
    },
    {
      "key": "F1",
      "width": 1
    }
  ]
]

key is to have all parameters inside the key-object

skullydazed commented 5 years ago

If you are going to consider changing the format I humbly suggest you use the format we've decided on in QMK. This would allow sharing layout files between keyboard-layout-editor and QMK Configurator. We describe it here: https://docs.qmk.fm/#/reference_info_json?id=layout-format

We'd be willing to extend that format to cover KLE's needs.

chiboreache commented 5 years ago

So it's the standart already, ok, I get it

but instead implement special parser for 1000 loc(founded in some helper site) we could all just use a dead simple json...

ijprest commented 5 years ago

It's admittedly pretty arcane (it made sense at the time), but I'm not currently looking to change the format.

However, if you want to read the files to do something with them, I did just create an NPM package with official code to deserialize the format. https://github.com/ijprest/kle-serial