forked from ingydotnet/jsony-pm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
88 lines (60 loc) · 2.28 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
NAME
JSONY - Relaxed JSON with a little bit of YAML
SYNOPSIS
use JSONY;
my $data = JSONY->new->load($jsony_string);
DESCRIPTION
JSONY is a data language that is simlar to JSON, just more chill. All
valid JSON is also valid JSONY (and represents the same thing when
loaded), but JSONY lets you omit a lot of the syntax that makes JSON a
pain to write.
API
JSONY has one object method: "load". You pass it a JSONY string and it
returns the loaded Perl data object.
JSONY SYNTAX
Here is some examples of JSONY followed by equivalent JSON:
Words don't need quotes. A list of things is an array:
foo bar baz
[ "foo", "bar", "baz" ]
Strings with spaces can use single or double quotes:
'foo bar' # <= This is (a comment indicating) a string
# More commenting
"baz boom "
[ "foo bar ", "baz boom " ]
Top level hashes can be ':' separated pairs or use curlies. Sub hashes
require curlies.
foo: { bar baz }
num: -1.2e3
{ "foo": { "bar": "baz" }, "num": -1.2e3 }
Top level arrays can use '- ' at the start of lines. Those arrays go the
end of line. Lines can be continued using a trailing comma. Sub arrays
require square brackets.
- array of 4 scalars
- array with [ sub
array { of
things }]
- array of 7 things on,
two lines
[
[ "array", "of", 4, "scalars" ],
[ "array", "with", [ "sub", "array" { "of": "things" } ] ],
[ "array", "of", 7, "things", "on", "two", "lines" ]
]
More soon...
NOTE: You may want to look at the tests (especially "t/load.t") to see
the full abilities of JSONY.
STATUS
BEWARE!!!
JSONY is mst's idea, and ingy's Pegex based implementation. The language
is just a baby, and will change a lot, or may go away entirely.
Development people are currently working on this in "#jsony" in
irc.freenode.net. Please drop by.
http://jsony.org coming soon.
AUTHORS
Ingy döt Net (ingy) <[email protected]>
Matt S. Trout (mst) <[email protected]>
COPYRIGHT
Copyright (c) 2012, 2013 Ingy döt Net
LICENSE
This library is free software and may be distributed under the same
terms as perl itself.