in reply to Escaping quotes in JSON string

RichardK

Unfortunately that is how I receive the data Doing a manual edit eg escaping each ' & " I can pass the data as JSON (This can be done on test data but not on a couple of million records) using the allow_singlequote. my problem is how do I escape the quotes inside 'value' prior to turning it into JSON object? </P

Replies are listed 'Best First'.
Re^2: Escaping quotes in JSON string
by Corion (Patriarch) on Oct 11, 2015 at 19:01 UTC

    You will have to write a parser for your not-JSON instead of trying to make JSON modules accept your not-JSON.

    I would look at the source of JSON::Tiny, which should work with the little change of escaping ' and ", by doubling them instead of putting a backslash in front of them.