The problem is that qr/.../ produces a Regexp object (try ref(qr/.../)).
If you know where all the regexes are in your structure, you could convert them all to strings before calling to_json() on them.
Or you can do:as documented in JSON{ package Regexp; sub TO_JSON { my $regex = shift; $regex = "$regex"; return $regex; } my $json = JSON->new->convert_blessed; print $json->encode(qr/.../);
In reply to Re: JSON saving regex?
by thargas
in thread JSON saving regex?
by iaw4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |