JSON: Added json_escape_string() function

This commit adds a json_escape_string() function to escape strings based
on a passed set of replacement pairs. The variable argument functionality
in json_string() was also removed because it is never used and has been
demonstrated to cause problems with strings containing % signs.
JSON: Escape percent signs in most strings

A printf-family function is used for flexibility reasons when adding
a string to the JSON structure. For this reason any percent signs in
strings generated external to the JSON code (object attributes, plugin
output, etc.) should have percent signs escaped (to "%%") before being
added in the json_*_append_string() functions to prevent the % sign
from being interpreted as a format specifier.

This commit accomplishes that by passing a structure with the escapes
to the json_*_append_string() functions where escaping is desired and
a NULL when it is not desired. When json_object_append_string() sees a
non-null structure, it calls json_escape_string() on the string before
it calls the printf-family function.