Do you know where your variables are? | |
PerlMonks |
Re^3: Quick 'n dirty extraction of JSON from an HTML pageby tobyink (Canon) |
on Mar 09, 2021 at 14:29 UTC ( [id://11129374]=note: print w/replies, xml ) | Need Help?? |
Consider using the original regexp, which doesn't require keys to be quoted, and parsing the JSON using Cpanel::JSON::XS and turning relaxed mode. Javascript objects can of course still include values which cannot be encoded into JSON, for example:
So if your Javascript objects contain things like this, you'll be out of luck. You might want to wrap your JSON decoding in try/catch or eval.
In Section
Seekers of Perl Wisdom
|
|