Group
Extension

Matches 20

Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/Schema/json_or_str.pm ( view source; MetaCPAN )
package Sah::Schema::json_or_str;

use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
our $VERSION = '0.0
07'; # VERSION

our $schema = [any => {
    summary => 'A JSON-encoded data or string',
    'prefilters' => ['Str::try_decode_json'],
    description => <<'_',

You can use this schema if you want to 
ine
script as command-line argument or option, it will be tried to be JSON-decoded
first. If the string does not contain valid JSON, it will be left as-is as
string.

This schema is convenient on the 
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Data/Sah/Filter/perl/JSON/decode.pm ( view source; MetaCPAN )
ah::Filter::perl::JSON::decode;

use 5.010001;
use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
our $VE
 1,
        summary => 'Decode from JSON',
        might_fail => 1,
        examples => [
            {value=>'', valid=>0, summary=>'Empty string is not valid JSON'},
            {value=>'null', filt
 summary=>'Invalid JSON, missing closing quote'},
            {value=>{}, valid=>0, summary=>'Will become something like "HASH(0x560142d4e5e8)" and fail because it is not valid JSON'},
            #{v
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/SchemaR/hash_from_json.pm ( view source; MetaCPAN )
## no critic: TestingAndDebugging::RequireStrict
package Sah::SchemaR::hash_from_json;

our $DATE = '2022-11-15'; # DATE
our $VERSION = '0.007'; # VERSION

our $rschema = do{my$var={base=>"hash",clset
 JSON-encoded object\n(hash). Data will not be valid if the string does not contain valid JSON.\n\nNote that hash data is accepted, unlike the `json_str::hash` schema which only\naccepts hash in JSON-
amples=>[{summary=>"Empty string is not a valid JSON",valid=>0,value=>""},{summary=>"Valid JSON but not a hash",valid=>0,value=>1},{summary=>"Valid JSON but not a hash",valid=>0,value=>"[]"},{summary=
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/SchemaR/json_or_str.pm ( view source; MetaCPAN )
## no critic: TestingAndDebugging::RequireStrict
package Sah::SchemaR::json_or_str;

our $DATE = '2022-11-15'; # DATE
our $VERSION = '0.007'; # VERSION

our $rschema = do{my$var={base=>"any",clsets_af
e\nscript as command-line argument or option, it will be tried to be JSON-decoded\nfirst. If the string does not contain valid JSON, it will be left as-is as\nstring.\n\nThis schema is convenient on t
lated schema: `json_str`, `str::encoded_json`, `str::escaped_json`.\n\n",examples=>[{summary=>"Empty string, left as-is as string",valid=>1,value=>""},{valid=>1,value=>1},{summary=>"JSON-decoded and b
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/SchemaR/any_from_json.pm ( view source; MetaCPAN )
## no critic: TestingAndDebugging::RequireStrict
package Sah::SchemaR::any_from_json;

our $DATE = '2022-11-15'; # DATE
our $VERSION = '0.007'; # VERSION

our $rschema = do{my$var={base=>"any",clsets_
l be assumed to be a\nJSON-encoded value and decoded. Data will not be valid if the string does not\ncontain valid JSON.\n\nThus, if you want to supply a string, you have to JSON-encode it.\n\n",examp
a valid JSON",valid=>0,value=>""},{summary=>"A number",valid=>1,value=>1},{valid=>1,validated_value=>undef,value=>"null"},{summary=>"Not a valid JSON literal, you have to encode string in JSON",valid=
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/Schema/array_from_json.pm ( view source; MetaCPAN )
kage Sah::Schema::array_from_json;

use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
our $VERSION = '0.
07'; # VERSION

our $schema = [array => {
    summary => 'Array, coercible from JSON string',
    'prefilters' => ['JSON::decode_str'],
    description => <<'_',

You can use this schema if you want t
ontains a JSON-encoded array.
Data will not be valid if the string does not contain valid JSON.

Note that array data is accepted, unlike the `json_str::array` schema which only
accepts JSON-encoded a
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/SchemaR/array_from_json.pm ( view source; MetaCPAN )
## no critic: TestingAndDebugging::RequireStrict
package Sah::SchemaR::array_from_json;

our $DATE = '2022-11-15'; # DATE
our $VERSION = '0.007'; # VERSION

our $rschema = do{my$var={base=>"array",cls
tains a JSON-encoded array.\nData will not be valid if the string does not contain valid JSON.\n\nNote that array data is accepted, unlike the `json_str::array` schema which only\naccepts JSON-encoded
mples=>[{summary=>"Empty string is not a valid JSON",valid=>0,value=>""},{summary=>"Valid JSON but not an array",valid=>0,value=>1},{summary=>"Valid JSON but not an array",valid=>0,value=>"{}"},{summa
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/Schema/hash_from_json.pm ( view source; MetaCPAN )
ckage Sah::Schema::hash_from_json;

use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
our $VERSION = '0.
007'; # VERSION

our $schema = [hash => {
    summary => 'Hash, coerced from JSON string',
    'prefilters' => ['JSON::decode_str'],
    description => <<'_',

You can use this schema if you want to a
 a JSON-encoded object
(hash). Data will not be valid if the string does not contain valid JSON.

Note that hash data is accepted, unlike the `json_str::hash` schema which only
accepts hash in JSON-en
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/Schema/json_str.pm ( view source; MetaCPAN )
package Sah::Schema::json_str;

use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
our $VERSION = '0.007'
t contains valid JSON',
    'prefilters' => ['JSON::check_decode'],
    description => <<'_',

This schema can be used if you want to accept a string that contains valid JSON.
The JSON string will not
. a JSON-encoded array will not beome an
array) but you know that the string contains a valid JSON. Data will not be
valid if the string does not contain valid JSON.

See also related schema: `json_or
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/SchemaR/json_str.pm ( view source; MetaCPAN )
## no critic: TestingAndDebugging::RequireStrict
package Sah::SchemaR::json_str;

our $DATE = '2022-11-15'; # DATE
our $VERSION = '0.007'; # VERSION

our $rschema = do{my$var={base=>"str",clsets_after
string that contains valid JSON.\nThe JSON string will not be decoded (e.g. a JSON-encoded array will not beome an\narray) but you know that the string contains a valid JSON. Data will not be\nvalid i
g does not contain valid JSON.\n\nSee also related schema: `json_or_str`, `str::encoded_json`,\n`str::escaped_json`.\n\n",examples=>[{summary=>"Empty string is not a valid JSON",valid=>0,value=>""},{v
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/Schemas/JSON.pm ( view source; MetaCPAN )
g::RequireUseStrict
package Sah::Schemas::JSON;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
our $VERSION = '0.007'; # VERSIO
elated to JSON

__END__

=pod

=encoding UTF-8

=head1 NAME

Sah::Schemas::JSON - Various schemas related to JSON

=head1 VERSION

This document describes version 0.007 of Sah::Schemas::JSON (from Per
tion Sah-Schemas-JSON), released on 2022-11-15.

=head1 SAH SCHEMAS

The following schemas are included in this distribution:

=over

=item * L<any_from_json|Sah::Schema::any_from_json>

A data struct
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Data/Sah/Filter/perl/JSON/decode_str.pm ( view source; MetaCPAN )
::Filter::perl::JSON::decode_str;

use 5.010001;
use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
our $
ary => 'Decode from JSON if string, otherwise leave as-is',
        might_fail => 1,
        examples => [
            {value=>'', valid=>0, summary=>'Empty string is not valid JSON'},
            {va
 {value=>'"foo"', filtered_value=>'foo'},
            {value=>'"foo', valid=>0, summary=>'Invalid JSON, missing closing quote'},
            {value=>{}, summary=>'Not a string, so passed as-is'},
    
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Data/Sah/Filter/perl/JSON/check_decode_array.pm ( view source; MetaCPAN )
lter::perl::JSON::check_decode_array;

use 5.010001;
use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
o
at value can be decoded as JSON and it is an array',
        might_fail => 1,
        examples => [
            {value=>'', valid=>0, summary=>'Empty string is not valid JSON'},
            {value=>'n
 JSON but not an array'},
            {value=>'[1,2,3]'},
            {value=>'{"a":1}', valid=>0, summary=>'Valid JSON but not an array'},
            {value=>'"foo"', valid=>0, summary=>'Valid JSON 
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Data/Sah/Filter/perl/JSON/check_decode.pm ( view source; MetaCPAN )
:Filter::perl::JSON::check_decode;

use 5.010001;
use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
our 
'Check that value can be decoded as JSON',
        might_fail => 1,
        examples => [
            {value=>'', valid=>0, summary=>'Empty string is not valid JSON'},
            {value=>'null'},
   
 summary=>'Invalid JSON, missing closing quote'},
            {value=>{}, valid=>0, summary=>'Will become something like "HASH(0x560142d4e5e8)" and fail because it is not valid JSON'},
            #{v
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Data/Sah/Filter/perl/JSON/check_decode_hash.pm ( view source; MetaCPAN )
lter::perl::JSON::check_decode_hash;

use 5.010001;
use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
ou
hat value can be decoded as JSON and it is a hash',
        might_fail => 1,
        examples => [
            {value=>'', valid=>0, summary=>'Empty string is not valid JSON'},
            {value=>'nu
id JSON but not a hash'},
            {value=>'[1,2,3]', valid=>0, summary=>'Valid JSON but not a hash'},
            {value=>'{"a":1}'},
            {value=>'"foo"', valid=>0, summary=>'Valid JSON bu
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/SchemaR/json_str/array.pm ( view source; MetaCPAN )
maR::json_str::array;

our $DATE = '2022-11-15'; # DATE
our $VERSION = '0.007'; # VERSION

our $rschema = do{my$var={base=>"str",clsets_after_base=>[{description=>"\nThis schema is like the `json_str`
d JSON. The JSON string will not be decoded but you know that the string\ncontains a valid JSON. In addition to that, the JSON must encode an array. Data\nwill not be valid if it is not a valid JSON o
r if the JSON is not an array.\n\nNote that unlike the `array_from_json` schema, an array data is not accepted by\nthis schema. Data must be a string.\n\n",examples=>[{summary=>"Empty string is not a 
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/Schema/json_str/hash.pm ( view source; MetaCPAN )
package Sah::Schema::json_str::hash;

use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
our $VERSION = '
that contains valid JSON and the JSON encodes a hash (JavaScript object)',
    'prefilters' => ['JSON::check_decode_hash'],
    description => <<'_',

This schema is like the `json_str` schema: it acc
epts a string that contains
valid JSON. The JSON string will not be decoded but you know that the string
contains a valid JSON. In addition to that, the JSON must encode a hash
(JavaScript object). Da
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/Schema/json_str/array.pm ( view source; MetaCPAN )
package Sah::Schema::json_str::array;

use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
our $VERSION = 
A string that contains valid JSON and the JSON encodes an array',
    'prefilters' => ['JSON::check_decode_array'],
    description => <<'_',

This schema is like the `json_str` schema: it accepts a s
 JSON string will not be decoded but you know that the string
contains a valid JSON. In addition to that, the JSON must encode an array. Data
will not be valid if it is not a valid JSON or if the JSON
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/SchemaR/json_str/hash.pm ( view source; MetaCPAN )
emaR::json_str::hash;

our $DATE = '2022-11-15'; # DATE
our $VERSION = '0.007'; # VERSION

our $rschema = do{my$var={base=>"str",clsets_after_base=>[{description=>"\nThis schema is like the `json_str`
accepts a string that contains\nvalid JSON. The JSON string will not be decoded but you know that the string\ncontains a valid JSON. In addition to that, the JSON must encode a hash\n(JavaScript objec
t). Data will not be valid if it is not a valid JSON or if the\nJSON is not a hash.\n\nNote that unlike the `hash_from_json` schema, a hash data is not accepted by\nthis schema. Data must be a string.
Sah-Schemas-JSON ( P/PE/PERLANCAR/Sah-Schemas-JSON-0.007.tar.gz, PERLANCAR, 2023; MetaCPAN )
Sah-Schemas-JSON/lib/Sah/Schema/any_from_json.pm ( view source; MetaCPAN )
ackage Sah::Schema::any_from_json;

use strict;
use warnings;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-11-15'; # DATE
our $DIST = 'Sah-Schemas-JSON'; # DIST
our $VERSION = '0.
VERSION

our $schema = [any => {
    summary => 'A data structure, coerced from JSON string',
    'prefilters' => ['JSON::decode_str'],
    description => <<'_',

You can use this schema if you want t
will be assumed to be a
JSON-encoded value and decoded. Data will not be valid if the string does not
contain valid JSON.

Thus, if you want to supply a string, you have to JSON-encode it.

_
    exam

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.