| 1 |
/* |
| 2 |
* Copyright (C) 2014 Red Hat, Inc. |
| 3 |
* SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef COCKPIT_JSON_H__ |
| 7 |
#define COCKPIT_JSON_H__ |
| 8 |
|
| 9 |
#include <glib.h> |
| 10 |
|
| 11 |
#include <json-glib/json-glib.h> |
| 12 |
|
| 13 |
G_BEGIN_DECLS |
| 14 |
|
| 15 |
JsonNode * cockpit_json_parse (const char *data, |
| 16 |
gssize length, |
| 17 |
GError **error); |
| 18 |
|
| 19 |
JsonObject * cockpit_json_parse_object (const gchar *data, |
| 20 |
gssize length, |
| 21 |
GError **error); |
| 22 |
|
| 23 |
JsonObject * cockpit_json_parse_bytes (GBytes *data, |
| 24 |
GError **error); |
| 25 |
|
| 26 |
gchar * cockpit_json_write (JsonNode *node, |
| 27 |
gsize *length); |
| 28 |
|
| 29 |
GBytes * cockpit_json_write_bytes (JsonObject *object); |
| 30 |
|
| 31 |
gboolean cockpit_json_get_int (JsonObject *object, |
| 32 |
const gchar *member, |
| 33 |
gint64 defawlt, |
| 34 |
gint64 *value); |
| 35 |
|
| 36 |
gboolean cockpit_json_get_bool (JsonObject *object, |
| 37 |
const gchar *member, |
| 38 |
gboolean defawlt, |
| 39 |
gboolean *value); |
| 40 |
|
| 41 |
gboolean cockpit_json_get_string (JsonObject *object, |
| 42 |
const gchar *member, |
| 43 |
const gchar *defawlt, |
| 44 |
const gchar **value); |
| 45 |
|
| 46 |
gboolean cockpit_json_get_strv (JsonObject *object, |
| 47 |
const gchar *member, |
| 48 |
const gchar **defawlt, |
| 49 |
const gchar ***value); |
| 50 |
|
| 51 |
gboolean cockpit_json_get_object (JsonObject *options, |
| 52 |
const gchar *member, |
| 53 |
JsonObject *defawlt, |
| 54 |
JsonObject **value); |
| 55 |
|
| 56 |
GHashTable * cockpit_json_to_hash_table (JsonObject *object, |
| 57 |
const gchar **fields); |
| 58 |
|
| 59 |
#endif /* COCKPIT_JSON_H__ */ |