e53ecf333db04604a76787d45552f4c392585859 chinhli Wed Oct 2 12:14:17 2013 -0700 Added jsonFindNameRecurse() and jsonFindName() to extract the email address from JSON file. diff --git src/hg/inc/jsHelper.h src/hg/inc/jsHelper.h index d8d6dab..7f97787 100644 --- src/hg/inc/jsHelper.h +++ src/hg/inc/jsHelper.h @@ -199,16 +199,24 @@ // prints out the "common" globals json hash // This hash is the one utils.js and therefore all CGIs know about void jsonErrPrintf(struct dyString *ds, char *format, ...); // Printf a json error to a dyString for communicating with ajax code; format is: // {"error": error message here} struct jsonElement *jsonParse(char *str); // parse string into an in-memory json representation 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 *sn); +// Search the JSON tree recursively to find all the values associated to +// the name. Value found are added to the tail of the slName list + +struct slName *jsonFindName(struct jsonElement *json, char *jName); +// Search the JSON tree to find all the values associated to the name +// and put them into a slName list. The first element of the list is the +// name itself and values are added to the tail of the list. #endif /* JSHELPER_H */