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
}
- Redundant commas are allowed in object and array definition. e.g.
{
"color": "red",,,
"elems": [1,,,,2,3,4,,,],
"weight": 10,
}
- Commas can be omitted in definition of object and array. e.g.
{
"color": "red"
"elems": [1 2 3 4]
"weight": 10
}
- 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.
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.
This library is distributed under BSD license.