json_escape_str_token

Contents

Description

Quote and check adding escape for JSON string

Syntax

int json_escape_str_token(string* pstr)

Parameters

pstr
[input/output] pointer to a string to be converted

Return

Size of the resulting string, -1 if null is passed in

Examples

EX1

#include <ojsu.h>
void json_escape_str_token_ex1()
{
        string str = "abc\"e       fg";
        json_escape_str_token(&str);
        out_str(str);
}

Remark

See Also

json_generate_key_value_str, json_separate_key_value_str

header to Include

ojsu.h

Reference