34 #include <json/json.h>
44 { json_object_put(
m_json); }
59 {
return PJSON(json_object_new_string(v)); }
62 {
return PJSON(json_object_new_string(v.c_str())); }
65 {
return PJSON(json_object_new_string((
const char *)v)); }
68 {
return PJSON(json_object_new_object()); }
71 {
return PJSON(json_object_new_array()); }
74 {
return PJSON(json_tokener_parse(str)); }
86 {
if (!
IsObject())
return false; json_object_object_add(
m_json, key, json_object_get(obj.
m_json));
return true; }
89 {
if (!
IsObject())
return false; json_object_object_del(
m_json, key);
return true; }
92 {
if (!
IsArray())
return false; json_object_array_add(
m_json, json_object_get(obj.
m_json));
return true; }
95 {
return m_json == NULL ? 0 : json_object_array_length(
m_json); }
101 {
if (
m_json != NULL) strm << json_object_to_json_string(
m_json); }
115 {
m_json = json_object_new_boolean(v); }
118 {
m_json = json_object_new_double(v); }
121 {
m_json = json_object_new_int(v); }
124 {
m_json = json_object_new_string(v); }
126 bool IsType(
enum json_type type)
const {
return json_object_is_type(
m_json, type); }
132 { base.
PrintOn(strm);
return strm; }
134 #endif // PTLIB_PJSON_H