YAML::P...a::JSON(3)
π NAME π
okay so welcome to the YAML::P...a::JSON(3) page from the User Contributed Perl Documentation, bestie β this one's all about YAML::PP::Schema::JSON, aka the YAML 1.2 JSON Schema, and she's iconic π
β¨
β¨ SYNOPSIS β¨
Three lil ways to summon the vibe:
my $yp = YAML::PP->new( schema => ['JSON'] );
my $yp = YAML::PP->new( schema => [qw/ JSON empty=str /] );
my $yp = YAML::PP->new( schema => [qw/ JSON empty=null /] );
π¦ DESCRIPTION π¦
With this schema, the resolution of plain values works like JSON: everything that matches a special value gets loaded as that special value, and every other plain scalar gets loaded as a string. periodt π
Note that this is different from the official YAML 1.2 JSON Schema, where all strings have to be quoted. π
Here you can see all Schemas and examples implemented by YAML::PP:
<https://perlpunk.github.io/YAML-PP-p5/schemas.html>
Official Schema:
<https://yaml.org/spec/1.2/spec.html#id2803231>
π CONFIGURATION π
The official YAML 1.2 JSON Schema wants all strings to be quoted. YAML::PP currently does not require that (it might do this optionally in the future). That means there are no empty nodes allowed in the official schema. Example:
---
key:
The default behaviour of YAML::PP::Schema::JSON is to return an empty string, so it would be equivalent to:
---
key: ''
You can configure it to resolve this as "undef":
my $yp = YAML::PP->new( schema => [qw/ JSON empty=null /] );
This way it is equivalent to:
---
key: null
The default is:
my $yp = YAML::PP->new( schema => [qw/ JSON empty=str /] );
π οΈ METHODS π οΈ
registerβ Called byYAML::PP::Schema.represent_bool,represent_float,represent_int,represent_literal,represent_undefβ Functions to represent the several node types.
represent_bool($representer, $node);
mwah π β brought to you by perl v5.42.0, dated 2026-04-24, with the footer title YAML::P...a::JSON(3) doing its lil encore π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-YAML-PP 0.40.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms