parseQuotedString :: Parser String
parseQuotedString = quoted $ many stringChar
  where
    quoted :: Parser a -> Parser a
    quoted = between (char '\"') (char '\"')

    stringChar :: Parser Char
    stringChar = escapedChar <|> noneOf "\""

    escapedChar :: Parser Char
    escapedChar = char '\\' *> choice (zipWith escape codes replacements)

    escape :: Char -> Char -> Parser Char
    escape code replacement = replacement <$ char code

    codes, replacements :: [Char]
    codes        = ['b',  'n',  'f',  'r',  't',  '\\', '\"', '/']
    replacements = ['\b', '\n', '\f', '\r', '\t', '\\', '\"', '/']
parseQuotedString :: Parser String
parseQuotedString = quoted $ many stringChar
  where
    quoted :: Parser a -> Parser a
    quoted = between (char '\"') (char '\"')

    stringChar :: Parser Char
    stringChar = escapedChar <|> noneOf "\""

    escapedChar :: Parser Char
    escapedChar = char '\\' *> choice (zipWith escape codes replacements)

    escape :: Char -> Char -> Parser Char
    escape code replacement = replacement <$ char code

    codes, replacements :: [Char]
    codes        = ['b',  'n',  'f',  'r',  't',  '\\', '\"', '/']
    replacements = ['\b', '\n', '\f', '\r', '\t', '\\', '\"', '/']
parseQuotedString = quoted $ many stringChar
  where
    quoted :: Parser a -> Parser a
    quoted = between (char '\"') (char '\"')

    stringChar :: Parser Char
    stringChar = escapedChar <|> noneOf "\""

    escapedChar :: Parser Char
    escapedChar = char '\\' *> choice (zipWith escape codes replacements)

    escape :: Char -> Char -> Parser Char
    escape code replacement = replacement <$ char code

    codes, replacements :: [Char]
    codes        = ['b',  'n',  'f',  'r',  't',  '\\', '\"', '/']
    replacements = ['\b', '\n', '\f', '\r', '\t', '\\', '\"', '/']