Greenbone Vulnerability Management Libraries 22.41.0
json.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Greenbone AG
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 */
5
6#ifndef _GVM_UTIL_JSON_H
7#define _GVM_UTIL_JSON_H
8
9#define _GNU_SOURCE
10
11#include <cjson/cJSON.h>
12#include <glib.h>
13
14gchar *
15gvm_json_string_escape (const char *, gboolean);
16
17double
18gvm_json_obj_double (cJSON *, const gchar *);
19
20int
21gvm_json_obj_check_int (cJSON *, const gchar *, int *);
22
23int
24gvm_json_obj_int (cJSON *, const gchar *);
25
26int
27gvm_json_obj_check_str (cJSON *, const gchar *, gchar **);
28
29gchar *
30gvm_json_obj_str (cJSON *, const gchar *);
31
32#endif /* not _GVM_UTIL_JSON_H */
double gvm_json_obj_double(cJSON *obj, const gchar *key)
Get a double field from a JSON object.
Definition json.c:75
int gvm_json_obj_check_int(cJSON *obj, const gchar *key, int *val)
Get an int field from a JSON object.
Definition json.c:97
gchar * gvm_json_string_escape(const char *string, gboolean single_quote)
Escapes a string according to the JSON or JSONPath standard.
Definition json.c:17
int gvm_json_obj_int(cJSON *obj, const gchar *key)
Get an int field from a JSON object.
Definition json.c:120
gchar * gvm_json_obj_str(cJSON *obj, const gchar *key)
Get a string field from a JSON object.
Definition json.c:165
int gvm_json_obj_check_str(cJSON *obj, const gchar *key, gchar **val)
Get a string field from a JSON object.
Definition json.c:142