damon2
v4.3.7
Published
A JSON shorthand
Readme
DAMON: A Map-Oriented Notation
A JSON-shorthand that:
- Stores insertion order
- Embraces the offside-rule
- Reuses JSON types
Demo
Syntax
Use Cases
- Wiki Data-entry
- Software Design
- Interactive Documents
Installation
Node:
npm install damon2Building
npm run watch # dev
npm run build # distribuableUsage
Core methods:
const Damon = require('damon2');
let damon = new Damon();
let damonString = `
- {}
- key: "value"`;
console.log(damon.damonToJSON(damonString));
// {
// "key": "value"
// }
console.log(damon.jsonToDAMON(damon.damonToJSON(damonString)));
// - {}
// - key: "value"
console.log(damon.damonToMap(damonString));
// Map(1) {"key" => "value"}IJSON export
For ordered-JSON and key-value S-Expressions:
const Damon = require('damon2');
let damon = new Damon();
let damonString = `
- key: {}
- key: null`;
console.log(damon.damonToIJSON(damonString));
// {
// "0-key": {
// "0-key": null
// }
// }
// Or, using DAMON-UTILS:
const DamonUtils = require('damon-utils');
const damonUtils = new DamonUtils(damon);
console.log(damonUtils.damonToSExpression(damonString));
// ["key", "key"]Attributions
Built on:
- JSON-types and JSON.parse()
- json-in-order @sanderevers
Going further
License
Copyright © 2024 Adrian Turcev
Licensed under the MPL-2.0 license
