summaryrefslogtreecommitdiff
path: root/sys/include/json.h
blob: efe5cb56a37b0d5f646b7f86837dc71f201cb119 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma src "/sys/src/libjson"
#pragma lib "libjson.a"

typedef struct JSONEl JSONEl;
typedef struct JSON JSON;

#pragma varargck type "J" JSON*

enum {
	JSONNull,
	JSONBool,
	JSONNumber,
	JSONString,
	JSONArray,
	JSONObject,
};

struct JSONEl {
	char *name;
	JSON *val;
	JSONEl *next;
};

struct JSON
{
	int t;
	union {
		double n;
		char *s;
		JSONEl *first;
	};
};

JSON*	jsonparse(char *);
void	jsonfree(JSON *);
JSON*	jsonbyname(JSON *, char *);
char*	jsonstr(JSON *);
int	JSONfmt(Fmt*);
void	JSONfmtinstall(void);