Escape special characters in JSON for v2 API

When assembling the JSON for the v2 API request, make sure the special
characters "double quote" and "backslash" are properly escaped, to prevent
malformed JSON requests.