Salesforce.com interface to directly access Salesforce.com
Dependencies: HTTPClient-SSL MbedJSONValue
Dependents: df-2014-salesforce-hrm-k64f
Fork of SalesforceInterface by
Diff: SalesforceInterface.cpp
- Revision:
- 22:3363752cd523
- Parent:
- 21:e5a4471a46fb
--- a/SalesforceInterface.cpp Fri Sep 26 03:42:20 2014 +0000 +++ b/SalesforceInterface.cpp Fri Sep 26 04:34:33 2014 +0000 @@ -847,4 +847,19 @@ int SalesforceInterface::min(int value1,int value2) { if (value1 < value2) return value1; return value2; + } + + // look for a specific key value pair in a json message + bool SalesforceInterface::contains(char *json,char *key,char *value) { + bool has_it = false; + + if (json != NULL && key != NULL && value != NULL) { + // parse the json and look for a specific <key,value> pair... + MbedJSONValue parsed; + parse(parsed,json); + char *answer = (char *)parsed[key].get<std::string>().c_str(); + if (strcmp(answer,value) == 0) has_it = true; + } + + return has_it; } \ No newline at end of file