xml - json text or perl structure exceeds maximum nesting level (max_depth set too low?) -
i getting following error json's encode_json
:
json text or perl structure exceeds maximum nesting level (max_depth set low?)
the code in question
my $jsonstring = encode_json($dataxml);
$dataxml
produced xml::simple's xmlin
. pointers how remove error?
you error json::pp when structure has 512 levels of nesting. it's meant catch unserializable reference loops (my $data = { }; $data->{foo} = $data;
) , prevent malicious attempts use memory.
if aren't problems, if issue need support ginormous structures, can increase threshold using ->max_depth
. keep mind that
encode_json($data)
is short for
my $json = json->new->utf8; $json->encode($data)
so can use
my $json = json->new->utf8->max_depth(...); $json->encode($data)
alternatively, json::xs might not have check. if doesn't, installing json::xs avoid error. that's on top of speeding encoding , decoding.
Comments
Post a Comment