2.1.6.24 json_generate_key_value_str

Description

Get a JSON key-value string from a key string array and a value string array

Syntax

int json_generate_key_value_str(string* pstrResult, StringArray* psaKeys, StringArray* psaVals)

Parameters

pstrResult
[output] pointer to resulting JSON key-value string
psaKeys
[input] string array for the keys
psaVals
[input] string array for the values

Return

Number of key-value pairs

Examples

EX1

#include <ojsu.h>
void json_generate_key_value_str_ex1() 
{ 
	vector<string> vsKeys; 
	vsKeys.Add("Input XY"); 
	vsKeys.Add("New XY"); 
	
	vector<string> vsValues; 
	vsValues.Add("(<input>,<input>)"); 
	vsValues.Add("[<new>]<new>!(<new>,<new>)");

	string str; 
	json_generate_key_value_str(&str, &vsKeys, &vsValues); 
	out_str( str ); 
}

Remark

See Also

json_separate_key_value_str

Header to Include

ojsu.h

Reference