in reply to JSON error '"' expected, at character offset 1

JSON::PP's with allow_singlequote and allow_barekey should do the trick

Replies are listed 'Best First'.
Re^2: JSON error '"' expected, at character offset 1
by odrevet (Acolyte) on Jan 02, 2010 at 14:54 UTC
    Thanks a lot everyone, both solution works. I'll use  $response =~s/[{:,]\K(\w+)(?=[:,}])/"$1"/g; to limit module usage, but PP is fine.
      What's wrong with using a module, and why would you rather do it wrong? (Your thing won't work if any string contains a double quote, for example.)
        Right, I finally use JSON::PP because the JSON I get is really bad, so I need thoses allow_xxx methodes.

        Your regep is still a nice pice of code for the ones who need to use JSON::XS.

        Thanks again St ikegami, you've got my 畏敬 respect.