IODX

Input Output Data syntaX

IODX is a compact, human-readable syntax for any structured data. It is like JSON or YAML, but better.

Features

Syntax

// list
(string 'quoted string' 123)

// maps
usualMap = (key=value 'quoted key'="quoted value")
emptMap = (=)

// entity
entity(key=values and some list also)

// strings
can_be_unquoted 

'single quoted do not need to escape "double" quotes, but \"can do so\"'

"double quoted do not need to escape 'single' quotes, but also \'can\'"

'any string
can have new lines
in it'

"escaping is useful\s\s
and it is optional\n\n
except for \\ and \" "

// other primitives
numbers = (123 1.23f -12.3d etc)
booleans = (true false)
nulls = null

Real life examples

// Some hierarchical UI definition
HBox(
  pos = (100 200)
  VBox(
    Input(hint = '...input here')
    Button(text = Send)
  )
)

Roughly the same structure in JSON:

{
  "type": "HBox",
  "pos": [100, 200],
  "children": [
    {
      "type": "VBox",
      "children": [
        {
          "type": "Input",
          "hint": "...input here"
        },
        {
          "type": "Button",
          "text": "Send"
        }
      ]
    }
  ]
}

And in YAML:

type: HBox
pos:
  - 100
  - 200
children:
  - type: VBox
    children:
      - type: Input
        hint: ...input here
      - type: Button
        text: Send
// Some config
serverType = node
port = 8080
//port = 80
data = (info = "Awesome super server" author = "John Doe")
services = (AuthService() AdminService())

Roughly the same structure in JSON:

{
  "serverType": "node",
  "port": 8080,
  "data": {
    "info": "Awesome super server",
    "author": "John Doe"
  },
  "services": [
    {
      "type": "AuthService"
    },
    {
      "type": "AdminService"
    }
  ]
}

And in YAML:

serverType: node
port: 8080
data:
  info: Awesome super server
  author: John Doe
services:
  - type: AuthService
  - type: AdminService
// Some properties
greeting = 'Hello traveller!'

signature = '
Have a nice day,
travaller!
'

Roughly the same structure in JSON:

{
  "greeting": "Hello traveller!",
  "signature": "\nHave a nice day,\ntravaller!\n"
}

And in YAML:

greeting: Hello traveller!
signature: |

  Have a nice day,
  travaller!

API

yk.lang.iodx.Iodx is an entry point. Look there for common scenarios and exmples.

API features

mvn artifact

<repositories>
    <repository>
        <id>yk</id>
        <url>https://github.com/kravchik/mvn-repo/raw/master</url>
    </repository>
</repositories>

<dependency>
    <groupId>yk</groupId>
    <artifactId>iodx</artifactId>
    <version>0.4</version>
</dependency>

Current development version is 0.5-SNAPSHOT.