gchar *keys;
gchar *fields;
- JsonParser *parser;
JsonNode *jnode_keys;
JsonNode *jnode_fields;
"\"address\": \"rue morgue, 44\","
"\"incoming\": \"1342.81\"}");
- parser = json_parser_new ();
-
- if (!json_parser_load_from_data (parser, fields, -1, NULL))
- {
- return 0;
- }
-
- jnode_fields = json_parser_get_root (parser);
+ jnode_fields = zak_utils_json_parse_data (fields);
ht_fields = zak_utils_json_to_hashtable_gvalue (jnode_fields);
keys = g_strdup ("{\"id\": \"44\"}");
- parser = json_parser_new ();
-
- if (!json_parser_load_from_data (parser, keys, -1, NULL))
- {
- return 0;
- }
-
- jnode_keys = json_parser_get_root (parser);
+ jnode_keys = zak_utils_json_parse_data (keys);
ht_keys = zak_utils_json_to_hashtable_gvalue (jnode_keys);
fields = g_strdup ("{\"name\": \"my new name\","
"\"surname\": \"and this is the new sur'name with '\"}");
- parser = json_parser_new ();
-
- if (!json_parser_load_from_data (parser, fields, -1, NULL))
- {
- return 0;
- }
-
- jnode_fields = json_parser_get_root (parser);
+ jnode_fields = zak_utils_json_parse_data (fields);
ht_fields = zak_utils_json_to_hashtable_gvalue (jnode_fields);