in reply to json text or perl structure exceeds maximum nesting level
First, your call to ->max_depth doesn't do what you think it does. I think you should call it as:
JSON::XS->new->utf8->max_depth(100);
that is, leave the square brackets out.
Second, maybe your data structure cannot be serialized as JSON because it is circular? Have you inspected your data structure using Data::Dumper to see what it looks like?
#!perl -w use strict; use JSON::XS; # Create a simple circular data structure: my $output; $output = ['foo']; $output->[1] = $output; my $json = JSON::XS->new->utf8->max_depth(100); use Data::Dumper; print Dumper $output; print $json->encode($output); __END__ json text or perl structure exceeds maximum nesting level (max_depth s +et too low?) at tmp.pl line 13.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: json text or perl structure exceeds maximum nesting level
by Anonymous Monk on Jun 01, 2018 at 15:55 UTC |