2.0.1 • Published 11 months ago

johnjs v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

JOHN parser and serializer for JavaScript objects

JOHN

John is a data serialization notation and the default for the Jane language.

The full specification can be found in the Jane documentation at The Jane repo

Here's an example of how to use JOHN:

first_name "Nora"
last_name "Nijimi"
age 21
hobbies [
    "programming"
    "gaming"
]
graduation_grades [
    ("maths" 100.0)
    ("science" 100.0)
    ("physical education" 0.0)
]
best_friend {
    first_name "Rashi"
    last_name "Klavae"
    age 20
    hobbies [
        "sleeping very long"
    ]
}

JOHNjs

Warning: The formatter is not currently in a production-ready state.

johnjs is the library that connects john to js:

Parsing

You can parse a JOHN string like you would with JSON:

import JOHN from 'johnjs'
// or
const JOHN = require('johnjs');

JOHN.parse('hello "hi"');
// >>> { hello: "hi" }

And stringify it by using the stringify function:

JOHN.stringify({hello: "hi", wow: ['Very cool']});
// >>> hello "hi" wow [ "Very cool" ]

You can also format JOHN using the format function (this might not work!):

JOHN.format(`key "value" obj { key2 "value2" key3 "value3" }`);
// >>> key: "value",
// >>> obj {
// >>>     key2: "value2",
// >>>     key3: "value3",
// >>> }

JOHNjs includes typescript definitions for ease of use.

2.0.1

11 months ago

2.0.0

11 months ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago