JSON parser: Fix parsing of unicode escape sequences.

Also, refactor all json string-related functions, so they're much simpler now.