in reply to Can not use JSON module

Your string isn't a valid JSON. I tried with the recommended JSON::PP:
#!/usr/bin/perl use strict; use feature qw{ say }; use warnings; use JSON::PP; my $json = "{'k1':'v1','k2':'v2'}"; decode_json($json);

Error:

unexpected end of string while parsing JSON string, at character offse +t 2 (before "k1':'v1','k2':'v2'}")

JSON::XS gives even more informative message:

'"' expected, at character offset 1 (before "'k1':'v1','k2':'v2'}")

JSON understands double quotes only:

'{"k1":"v1","k2":"v2"}'
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Can not use JSON module
by LanX (Saint) on Jun 02, 2017 at 13:41 UTC