Subject: | Doesn't recognize empty strings |
Looks like empty strings ("") are not recognized properly, and JSON::YAJL swallows the rest of the file (or block).
Example script:
use strict;
use warnings;
use feature 'say';
use JSON::YAJL;
my $parser = JSON::YAJL::Parser->new(
0, 0,
[ sub { say "null" },
sub { say "bool: @_" },
undef,
undef,
sub { say "number: @_" },
sub { say "string: @_" },
sub { say "map_open" },
sub { say "map_key: @_" },
sub { say "map_close" },
sub { say "array_open" },
sub { say "array_close" },
]
);
while(<DATA>) {
$parser->parse($_);
}
$parser->parse_complete();
__DATA__
{ "foo": "", "bar": "baz" }
Output:
map_open
map_key: foo
string: ", "bar": "baz" }
map_key: bar
string: baz
map_close
cheers,
Aldo