use Carp;
use JSON::MaybeXS ();
use Try::Tiny;
our $VERSION = '++MODULE_VERSION++';
my $json = JSON::MaybeXS->new->allow_nonref;
sub parse {
my $schema = shift;
my $json_string = shif
|| "";
my $struct = try {
$json->decode($json_string);
}
catch {
throw Avro::Schema::Error::Parse(
"Cannot parse json string: $_"
);
};
return
return $json->encode($struct);
}
sub parse_struct {
my $schema = shift;
my $struct = shift;
my $names = shift || {};
my $namespace = shift || "";
## 1.3.2 A JSON object
$datafile->{_writer_schema}) {
my $json_schema = $datafile->metadata->{'avro.schema'};
$datafile->{_writer_schema} = Avro::Schema->parse($json_schema);
}
return $datafile->{_wr
imitations
# under the License.
package Avro::Protocol;
use strict;
use warnings;
use Carp;
use JSON::MaybeXS ();
use Try::Tiny;
use Avro::Protocol::Message;
use Avro::Schema;
use Error;
use Object:
ame
namespace
doc
types
messages
};
our $VERSION = '++MODULE_VERSION++';
my $json = JSON::MaybeXS->new->allow_nonref;
sub parse {
my $class = shift;
my $enc_proto = shif
mpty");
my $struct = try {
$json->decode($enc_proto);
}
catch {
throw Avro::Protocol::Error::Parse(
"Cannot parse json string: $_"
);
};
return
t;
use warnings;
use Config;
use Encode();
use Error::Simple;
use Regexp::Common qw(number);
use JSON::PP; # For is_bool
our $VERSION = '++MODULE_VERSION++';
# Private function deleted below, shoul
BinaryEncoder::Error("cannot encode a '$type' reference as boolean")
unless $type eq 'JSON::PP::Boolean';
}
else {
throw Avro::BinaryEncoder::Error( "'$data' is not a valid
")
unless $data eq '' # For Perl versions without builtin::is_bool
|| JSON::PP::is_bool($data)
|| $data =~ /^(?:true|t|false|f|yes|y|no|n|0|1)$/i;
}