App-Music-ChordPro
view release on metacpan or search on metacpan
lib/ChordPro/lib/JSON/Relaxed.pm view on Meta::CPAN
C<from_rjson> is kept as a synonym for C<decode_rjson>.
For the same reason, the old parser method C<parse> has been renamed
to C<decode>.
For compatibility C<parse> is kept as a synonym for C<decode>.
When called by one of the old names, JSON::Relaxed will operate in
legacy mode. This changes the way errors are handled.
=head1 REALLY RELAXED EXTENSIONS
Extensions are disabled if option C<strict> is set.
Otherwise, most extensions are enabled by default.
Some extensions need an additional option setting.
=head2 Leading commas in lists
For example,
[ , 1 ]
Enabled by default, overruled by C<strict>.
=head2 Hash keys without values
JSON::Relaxed supports object keys without a specified value.
In that case the hash element is simply assigned the undefined value.
In the following example, a is assigned 1, and b is assigned undef:
{ a:1, b }
Enabled by default, overruled by C<strict>.
=head2 String continuation
Long strings can be aesthetically split over multiple lines by putting
a backslash at the end of the line:
"this is a " \
"long string"
Note that this is different from
"this is a \
long string"
which B<embeds> the newline into the string, and requires continuation
lines to start at the beginning of the line to prevent unwanted spaces.
Enabled by default, overruled by C<strict>.
=head2 Extended Unicode escapes
Unicode escapes in strings may contain an arbitrary number of hexadecimal
digits enclosed in braces:
\u{1d10e}
This eliminates the need to use
L<surrogates|https://unicode.org/faq/utf_bom.html#utf16-2>
to obtain the same character:
\uD834\uDD0E
Enabled by default, overruled by C<strict>.
=head2 Combined hash keys
Hash keys that contain periods are considered subkeys, e.g.
foo.bar: blech
is equivalent to
foo: {
bar: blech
}
Requires C<combined_keys> or C<prp> option. Overruled by C<strict>.
=head2 Implied outer hash
If the JSON looks like a hash, i.e. a string (key) followed by a
C<:>, the outer C<{> and C<}> are implied.
For example:
foo : bar
is equivalent to:
{ foo : bar }
Requires C<implied_outer_hash> or C<prp> option. Overruled by C<strict>.
=head2 Garbage after JSON structure
Requires C<extra_tokens_ok> option. Overruled by C<strict>.
Normally, parsing will fail unless the input contains exactly one
valid JSON structure, i.e. a string, a hash or an array.
With C<extra_tokens_ok> the first JSON structure is parsed and the
rest is ignored.
=head2 PRP extensions
Requires C<prp> option. Overruled by C<strict>.
Enables some specific extensions:
The equal sign C<=> can be used as an alternative to C<:> (colon).
Colon (and equal sign) is optional between a key and its hash value.
Single-line comments may start with C<#>.
For example:
# This is a sample PRP extended Really Relaxed JSON.
( run in 0.900 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )