The `betweenQuotes` function seems to be incorrect as e.g. `\n` should be encoded as `\\n`, but all it does is to add the surrounding escape quotes. Here is a list of all JSON special characters: https://www.tutorialspoint.com/json_simple/json_simple_escape_characters.htm