1YAML::PP::Schema::JSON(U3s)er Contributed Perl DocumentatYiAoMnL::PP::Schema::JSON(3)
2
3
4

NAME

6       YAML::PP::Schema::JSON - YAML 1.2 JSON Schema
7

SYNOPSIS

9           my $yp = YAML::PP->new( schema => ['JSON'] );
10           my $yp = YAML::PP->new( schema => [qw/ JSON empty=str /] );
11           my $yp = YAML::PP->new( schema => [qw/ JSON empty=null /] );
12

DESCRIPTION

14       With this schema, the resolution of plain values will work like in
15       JSON.  Everything that matches a special value will be loaded as such,
16       other plain scalars will be loaded as strings.
17
18       Note that this is different from the official YAML 1.2 JSON Schema,
19       where all strings have to be quoted.
20
21       Here you can see all Schemas and examples implemented by YAML::PP:
22       <https://perlpunk.github.io/YAML-PP-p5/schemas.html>
23
24       Official Schwma: <https://yaml.org/spec/1.2/spec.html#id2803231>
25

CONFIGURATION

27       The official YAML 1.2 JSON Schema wants all strings to be quoted.
28       YAML::PP currently does not require that (it might do this optionally
29       in the future).
30
31       That means, there are no empty nodes allowed in the official schema.
32       Example:
33
34           ---
35           key:
36
37       The default behaviour of YAML::PP::Schema::JSON is to return an empty
38       string, so it would be equivalent to:
39
40           ---
41           key: ''
42
43       You can configure it to resolve this as "undef":
44
45           my $yp = YAML::PP->new( schema => [qw/ JSON empty=null /] );
46
47       This way it is equivalent to:
48
49           ---
50           key: null
51
52       The default is:
53
54           my $yp = YAML::PP->new( schema => [qw/ JSON empty=str /] );
55

METHODS

57       register
58           Called by YAML::PP::Schema
59
60       represent_bool, represent_float, represent_int, represent_literal,
61       represent_undef
62           Functions to represent the several node types.
63
64               represent_bool($representer, $node);
65
66
67
68perl v5.32.0                      2020-09-11         YAML::PP::Schema::JSON(3)
Impressum