Result:
found 25 distributions and 73 files matching your query ! ( run in 0.245 )


JSON-PP

 view release on metacpan or  search on metacpan

lib/JSON/PP.pm  view on Meta::CPAN

}


sub get_max_size { $_[0]->{max_size}; }

sub boolean_values {
    my $self = shift;
    if (@_) {
        my ($false, $true) = @_;
        $self->{false} = $false;
        $self->{true} = $true;

lib/JSON/PP.pm  view on Meta::CPAN

sub get_unblessed_bool {
    my $self = shift;
    return $self->get_core_bools(@_);
}

sub get_boolean_values {
    my $self = shift;
    if (exists $self->{true} and exists $self->{false}) {
        return @$self{qw/false true/};
    }
    return;

lib/JSON/PP.pm  view on Meta::CPAN


If C<$enable> is false (the default), then C<encode> will not consider
this type of conversion, and tagged JSON values will cause a parse error
in C<decode>, as if tags were not part of the grammar.

=head2 boolean_values

    $json->boolean_values([$false, $true])

    ($false,  $true) = $json->get_boolean_values

By default, JSON booleans will be decoded as overloaded
C<$JSON::PP::false> and C<$JSON::PP::true> objects.

With this method you can specify your own boolean values for decoding -

lib/JSON/PP.pm  view on Meta::CPAN

(and add a C<TO_JSON> method if necessary).

Calling this method without any arguments will reset the booleans
to their default values.

C<get_boolean_values> will return both C<$false> and C<$true> values, or
the empty list when they are set to the default.

=head2 core_bools

    $json->core_bools([$enable]);

If C<$enable> is true (or missing), then C<decode>, will produce standard
perl boolean values. Equivalent to calling:

    $json->boolean_values(!!1, !!0)

C<get_core_bools> will return true if this has been set. On perl 5.36, it will
also return true if the boolean values have been set to perl's core booleans
using the C<boolean_values> method.

The methods C<unblessed_bool> and C<get_unblessed_bool> are provided as aliases
for compatibility with L<Cpanel::JSON::XS>.

=head2 filter_json_object

 view all matches for this distribution
 view release on metacpan -  search on metacpan

JSON-Relaxed

 view release on metacpan or  search on metacpan

scripts/rrjson.pl  view on Meta::CPAN

	print "\n" unless $pretty;
    }
    elsif ( $mode eq "json_xs" ) {
	require JSON::XS;
	print ( JSON::XS->new->canonical->utf8(0)->pretty($pretty)
		->boolean_values( $JSON::PP::false, $JSON::PP::true )
		->convert_blessed->encode($data) );
    }

    elsif ( $mode eq "toml" ) {
	require TOML::Tiny;

scripts/rrjson.pl  view on Meta::CPAN

    }

    else {			# default JSON
	require JSON::PP;
	print ( JSON::PP->new->canonical->utf8(0)->pretty($pretty)
		->boolean_values( $JSON::PP::false, $JSON::PP::true )
		->convert_blessed->encode($data) );
    }
}

################ Subroutines ################

 view all matches for this distribution
 view release on metacpan -  search on metacpan

JSON-SIMD

 view release on metacpan or  search on metacpan

SIMD.pm  view on Meta::CPAN

in C<decode>, as if tags were not part of the grammar.

This option is not compatible with C<use_simdjson>, and using this option
will silently disable simdjson mode.

=item $json->boolean_values ([$false, $true])

=item ($false,  $true) = $json->get_boolean_values

By default, JSON booleans will be decoded as overloaded
C<$Types::Serialiser::false> and C<$Types::Serialiser::true> objects.

With this method you can specify your own boolean values for decoding -

SIMD.pm  view on Meta::CPAN

assigning a value to another variable, i.e. C<$copy = $false>).

Calling this method without any arguments will reset the booleans
to their default values.

C<get_boolean_values> will return both C<$false> and C<$true> values, or
the empty list when they are set to the default.

=item $json->core_bools([$enable])

=item $enabled = $json->get_core_bools

If C<$enable> is true (or missing), then subsequent C<decode>s will produce
standard perl boolean values. Equivalent to calling:

    $json->boolean_values(!!0, !!1)

C<get_core_bools> will return true if this has been set. On perl 5.36 or newer,
it will also return true if the boolean values have been set to perl's core
booleans using the boolean_values method.

If C<$enable> is false, the booleans are reset to their default values.

(See also C<encode_core_bools> for the encode counterpart of this.)

SIMD.pm  view on Meta::CPAN

C<Types::Serialiser::false>, respectively. They are overloaded to act
almost exactly like the numbers C<1> and C<0>. You can check whether
a scalar is a JSON boolean by using the C<Types::Serialiser::is_bool>
function (after C<use Types::Serialier>, of course).

You can also use the C<boolean_values> method to supply your own true
and false values for decoding, or the C<core_bools> method to decode to
Perl's standard booleans (the special values !!0 or !!1, also available
as the aliases C<false> and C<true> from the (experimental) C<builtin>
module since perl 5.36).

 view all matches for this distribution
 view release on metacpan -  search on metacpan

JSON-XS

 view release on metacpan or  search on metacpan

XS.pm  view on Meta::CPAN


If C<$enable> is false (the default), then C<encode> will not consider
this type of conversion, and tagged JSON values will cause a parse error
in C<decode>, as if tags were not part of the grammar.

=item $json->boolean_values ([$false, $true])

=item ($false,  $true) = $json->get_boolean_values

By default, JSON booleans will be decoded as overloaded
C<$Types::Serialiser::false> and C<$Types::Serialiser::true> objects.

With this method you can specify your own boolean values for decoding -

XS.pm  view on Meta::CPAN

assigning a value to another variable, i.e. C<$copy = $false>).

Calling this method without any arguments will reset the booleans
to their default values.

C<get_boolean_values> will return both C<$false> and C<$true> values, or
the empty list when they are set to the default.

=item $json = $json->filter_json_object ([$coderef->($hashref)])

When C<$coderef> is specified, it will be called from C<decode> each

 view all matches for this distribution
 view release on metacpan -  search on metacpan

JSON

 view release on metacpan or  search on metacpan

lib/JSON.pm  view on Meta::CPAN


If C<$enable> is false (the default), then C<encode> will not consider
this type of conversion, and tagged JSON values will cause a parse error
in C<decode>, as if tags were not part of the grammar.

=head2 boolean_values (since version 4.0)

    $json->boolean_values([$false, $true])

    ($false,  $true) = $json->get_boolean_values

By default, JSON booleans will be decoded as overloaded
C<$JSON::false> and C<$JSON::true> objects.

With this method you can specify your own boolean values for decoding -

lib/JSON.pm  view on Meta::CPAN

(and add a C<TO_JSON> method if necessary).

Calling this method without any arguments will reset the booleans
to their default values.

C<get_boolean_values> will return both C<$false> and C<$true> values, or
the empty list when they are set to the default.

=head2 filter_json_object

    $json = $json->filter_json_object([$coderef])

 view all matches for this distribution
 view release on metacpan -  search on metacpan

JSONLD

 view release on metacpan or  search on metacpan

lib/JSONLD.pm  view on Meta::CPAN

  use JSONLD;
  
  my $infile = 'test.jsonld';
  open(my $fh, '<', $infile) or die $!;
  my $content	= do { local($/); <$fh> };
  my $data = JSON->new()->boolean_values(0, 1)->decode($content);
  
  my $jld = JSONLD->new();
  my $expanded	= $jld->expand($data);

=head1 DESCRIPTION

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.245 second using v1.01-cache-2.11-cpan-9ff20fc0ed8 )