1ee99ce653ae839e4774120c3f3923dc129c8533
angie
  Fri Mar 16 14:41:14 2018 -0700
Moved jsonStringEscape inside jsonWriteString because it's silly to have to remember to call it first every time.
tagStorm programs were doing their own limited escaping (double-quotes only); now they get the same escaping as everywhere else.
refs MLQ #21113

diff --git src/inc/jsonParse.h src/inc/jsonParse.h
index 2af3706..8d73bfd 100644
--- src/inc/jsonParse.h
+++ src/inc/jsonParse.h
@@ -51,30 +51,39 @@
 void jsonObjectAdd(struct jsonElement *h, char *name, struct jsonElement *ele);
 // Add a new element to a jsonObject; existing values are replaced.
 
 void jsonObjectMerge(struct jsonElement *objA, struct jsonElement *objB);
 /* Recursively merge fields of objB into objA.  If objA and objB each have a list child with
  * the same key then concatenate the lists.  If objA and objB each have an object child with
  * the same key then merge the object children.  If objA and objB each have a child of some
  * other type then objB's child replaces objA's child. */
 
 void jsonListAdd(struct jsonElement *list, struct jsonElement *ele);
 // Add a new element to a jsonList
 
 struct jsonElement *jsonParse(char *str);
 // parse string into an in-memory json representation
 
+int jsonStringEscapeSize(char *inString);
+/* Return the size in bytes including terminal '\0' for escaped string. */
+
+void jsonStringEscapeBuf(char *inString, char *buf, size_t bufSize);
+/* backslash escape a string for use in a double quoted json string.
+ * More conservative than javaScriptLiteralEncode because
+ * some json parsers complain if you escape & or '.
+ * bufSize must be at least jsonStringEscapeSize(inString). */
+
 char *jsonStringEscape(char *inString);
 /* backslash escape a string for use in a double quoted json string.
  * More conservative than javaScriptLiteralEncode because
  * some json parsers complain if you escape & or ' */
 
 void jsonFindNameRecurse(struct jsonElement *ele, char *jName, struct slName **pList);
 // Search the JSON tree recursively to find all the values associated to
 // the name, and add them to head of the list.  
 
 struct slName *jsonFindName(struct jsonElement *json, char *jName);
 // Search the JSON tree to find all the values associated to the name
 // and add them to head of the list. 
 
 struct slName *jsonFindNameUniq(struct jsonElement *json, char *jName);
 // Search the JSON tree to find all the values associated to the name