Non Sucking YAML parser
Marvin Humphrey
marvin at rectangular.com
Wed Sep 13 05:37:03 BST 2006
On Sep 12, 2006, at 7:27 PM, Simon Wistow wrote:
> I'm trying to do some interop between Java and Perl. I'm trying to
> avoid
> XML. I thought I'd try JSON or YAML.
>
> The Java stuff works fine. YAML.pm seems to fail to parse half the
> data, YAML::Tiny bitches about malformedness, YAML::Syck seems to
> parse
> ok but then only ever returns 1 object even when there are multiple
> ones. JSON.pm fails to work.
FWIW, the JSON module has worked fine for me. I got bit by feeding
it blessed objects at first, which it just turns to undef by default
-- if I'd RTFM all the way through I would have known, but oh well.
Maybe you got bit by the same feature?
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/
#---------------------------------------------
slothbear:~/perltest marvin$ cat json.plx
#!/usr/bin/perl
use strict;
use warnings;
use JSON qw( objToJson );
my $obj = bless { foo => 1 }, 'Foo';
print "Attempt 1: " . objToJson($obj) . "\n";
$JSON::ConvBlessed = 1;
print "Attempt 2: " . objToJson($obj) . "\n";
slothbear:~/perltest marvin$ perl json.plx
Use of uninitialized value in concatenation (.) or string at json.plx
line 7.
Attempt 1:
Attempt 2: {"foo":1}
More information about the london.pm
mailing list