Skip to content

phinze/ljson

 
 

Repository files navigation

LJSON GoSearch

Loose JSON

Loose JSON(LJSON) is a superset of JSON which allows some imperfect formatting(i.e. the marshaller should be more robust).

Format differences to standard JSON:

A standard JSON data:

{
    "color": "red",
    "elems": [1,2,3,4],
    "weight": 10
}
  1. Redundant commas are allowed in object and array definition. e.g.
{
    "color": "red",,,
    "elems": [1,,,,2,3,4,,,],
    "weight": 10,
}
  1. Commas can be omitted in definition of object and array. e.g.
{
    "color": "red"
    "elems": [1 2 3 4]
    "weight": 10
}
  1. Support naked-key. If the key part of an element in an object, which is a string, contains naked-key-valid characters only, the embracing double quotes can be omitted(the key becomes a naked-key). naked-key-valid characters are printable characters other than the following: ", ', :, [, ], {, }, \, and ,. (This is similar to grammar in javascript)
{
    color : "red"
    elems : [1 2 3 4]
    weight: 10
}

This is useful especially when the data is written by hand, e.g. as a configure file.

Implemenation

This package implements decoder for LJSON. (For encoding, use build-in encoding/json package. Visit Godoc for LJSON for more usage information.

The code is modified from encoding/json package in go 1.0.3.

LICENSE

This library is distributed under BSD license.

About

Loose JSON, a superset of JSON with a loose format requirement.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%