【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.6.25 json_separate_key_value_str
Contents
Description
Get a key string array and a value string array from a JSON key-value string array
Syntax
int json_separate_key_value_str(string* pstrResult, StringArray* psaKeys, StringArray* psaVals, DWORD dwOptions = JKVS_OPT_ALLOW_EMPTY_SLOT)
Parameters
- pstrResult
- [input] pointer to JSON key-value string to extract
- psaKeys
- [output] extracted string array for the keys
- psaVals
- [output] extracted string array for the values
- dwOptions
- [input] option flags, only JKVS_OPT_ALLOW_EMPTY_SLOT is defined and set as default
Return
Number of key-value pairs
Examples
EX1
#include <ojsu.h> void json_separate_key_value_ex2() { string str = "{\"Input XY\":\"(<input>,<input>)\",\"New XY\" : \"[<new>]<new>!(<new>,<new>)\" }"; vector<string> vsk, vsv; json_separate_key_value_str(&str, &vsk, &vsv); for(int ii = 0; ii < vsk.GetSize(); ii++) { printf("%d:%s<->%s\n", ii+1, vsk[ii], vsv[ii]); } }
Remark
See Also
Header to Include
ojsu.h