JSON: Escape backslashes first

This commit causes backslashes to be escaped first so they don't cause
backslashes created by other escapes from being escaped themselves.