KYLI - because it is superior to JSON


This is a (silly) attempt to fix some of the shortcomings of JSON. Hence it is named after the goddess of music.

It uses C0 Control Characters

Here is an example:

␜
   ␁
      This is a KYLI document
   ␂
      ␝ GroupName
         ␞ data ␟ value
         ␛ Comments are supported too!
         They can be multilined easily.
␙

I've used Unicode Control Pictures so you can see what's happening. In reality, ␜ is  - which on your display looks like .

Why KYLI is 100x better than crummy JSON

JSON is ok, I guess. But it is fragile - breaking if a comma is out of place. It is also really hard to use with text; you either have to escape every " or ' - or remember to HTML encode (and decode) everything. It doesn't have comments. There's no versioning.

KYLI attempts to improve on some of those shortcomings. Here's how it works.

Philosophy

  1. Magic characters control the flow of the document.
  2. A magic character is terminated by the presence of another magic character. This means...
  3. Whitespace is a first class citizen. It can be used in names, values, comments.
  4. The only characters which can't be used within names and values are magic characters.
    1. Every other Unicode character is available for names, data, values, comments.
  5. There are no "types" - everything is a string.
    1. If you want to use an alternative numbering system, or use and for boolean, that's encouraged.

Structure

KYLI:

  • Will start with File Separator.
  • May have a header - indicated with
    • A header can contain any pertinent information. For example, KYLI version or document metadata.
    • Headers are unstructured. They can hold any valid text (including XML or JSON).
  • Will indicate the start of the data using Start of Text.
  • May contain data:
    • A datum's name will start with Record Separator.
    • A datum's value will start with Unit Separator.
    • All values are Unicode strings. There is no concept of number types or booleans.
    • Data may be grouped:
      • The group's name will start with Group Separator.
      • There is no limit to how many subgroups there may be.
  • Will end with End of Medium.

Examples

It is helpful to think of KYLI as a stream of Unicode characters. When viewing a document, you may want to "pretty print" it for your convenience.

Basic

The minimum viable KYLI is something like:

␜␞age␟42␙

Multi-lingual

Names can be any valid Unicode string (that is, which doesn't contain control characters).

␜
   ␁
      Generated on 2017-03-25
   ␂
      ␝ People's names
         ␝ 英国人
            ␛ That's the Chinese word for
              "English People"
            ␝ 123456
               ␞ Name ␟ Terence Eden
            ␝ 789456
               ␞ Name ␟ John Lennon
␙

Which is transmitted as

␜␁Generated on 2017-03-25␂␝Different People␝英国人␛That's the Chinese word for
"English People"␝123456␞Name␟Terence Eden␝789456␞Name␟John Lennon␙

Multiline data easily

␜
   ␂
      ␞ HTML for the site ␟ <!doctype html>
<html>
   <head>
       <title>
      ...
      ␞ date ␟ 2018-01-15
␙

Why this is better

  • It discourages editing by hand! You should be using tools to create data or config files. They can verify their validity quicker and more accurately than any human.
  • You don't need to worry about escaping "special" characters like "!
  • Comments!
  • No worrying about data types!
  • More compact!
  • No bloody commas tripping things up!
  • Metadata!
  • No confusion over whether something is an object, array, or string!
  • Easier to validate!

I am confident that KYLI will supplant JSON in the 1990s pop charts as the preferred data transmission standard of the 21st Century.

Kylie striking a pose https://www.flickr.com/photos/evarinaldiphotography/6805204016/

One thought on “KYLI - because it is superior to JSON

Leave a Reply

Your email address will not be published. Required fields are marked *