in reply to Re: JSON decode problem
in thread JSON decode problem
For example, in order to clean showParams, you need to detect unescaped quotes and escape them. For the sample you could run
but good luck maintaining that.my $str = 'showParams: "{"revertType":null,"refresh":false,"checkpoint +":false,"sheetName":"","unknownParams":"zone_id=6290&ac=a9aef098062f9 +646bd1638d0c6054c7b&account_id=62&Start_Date=2016-07-27&End_Date=2016 +-08-03","layoutId":""}"'; while ($str =~ /(?<!\\)"\s*\{\s*("(?:(?!\}").)*)\}"/) { substr($str, $-[1], $+[1] - $-[1]) =~ s/(?=["\\])/\\/g; }
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: JSON decode problem
by FreeBeerReekingMonk (Deacon) on Aug 11, 2016 at 21:16 UTC | |
by kennethk (Abbot) on Aug 15, 2016 at 15:45 UTC |