JSPM

node-mojangson

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q12932F
  • License MIT

A mojangson parser written in node.js

Package Exports

  • node-mojangson

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-mojangson) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-mojangson

NPM version Build Status

node-mojangson is a mojangson parser.

Mojangson specification

Mojangson is mojang's variant of json. It is basically json with the following changes :

  • array can be indexed (example : [0:"v1",1:"v2",2:"v3"])
  • array and object can have trailing comma (example : [5,4,3,] and {"a":5,"b":6,})
  • there can be string without quote (example : {mykey:myvalue})
  • numbers can be suffixed by b, s, l, f or the same in upper case (example : {number:5b})
  • mojangson stays a superset of json : every json is a mojangson

Parser

This parser is build using jison.

See the grammar and the examples in the test for more information.

Usage

Usage example :

var mojangson=require("mojangson");
console.log(mojangson.parse("{mykey:myvalue}"));

The provided method mojangson.parse return a javascript object corresponding to the mojangson passed in input.