App-Music-ChordPro
view release on metacpan or search on metacpan
lib/ChordPro/lib/JSON/Relaxed.pm view on Meta::CPAN
=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.
pdf.formats {
title.footer = [ "%{copyright}" "" "%{page}" ]
first.footer = [ "%{copyright}" "" "" ]
}
This is equivalent to Really Relaxed JSON:
// This is a sample Really Relaxed JSON.
pdf.formats: {
title.footer: [ "%{copyright}" "" "%{page}" ]
first.footer: [ "%{copyright}" "" "" ]
}
And Relaxed JSON:
// This is a sample Relaxed JSON.
{
pdf: {
formats: {
title: {
footer: [ "%{copyright}" "" "%{page}" ]
}
first: {
( run in 0.550 second using v1.01-cache-2.11-cpan-39bf76dae61 )