Loose JSON, a superset of JSON with a loose format requirement.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
testdata
.gitignore
README.md
bench_test.go
decode.go
decode_test.go
encode.go
encode_test.go
example_test.go
scanner.go
scanner_test.go
stream.go
stream_test.go
tagkey_test.go
tags.go
tags_test.go

README.md

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.