Improvements to json parsing (thanks Bradley Peabody)

It now remembers if a string was quoted with single or double quotes
and deals with both scenarios properly. Some cases of bad json could
go into an infinite loop, which now throw an exception.
Unwanted backslashes (something like \$ for example) now return the
literal character instead of throwing it away.
Cosmetic (ish)
merge bug25633 into stable