summaryrefslogtreecommitdiff
path: root/sys/src/cmd/btc/json.h
blob: 75b2a8ea771ba818af81a9cc56fe289cbc165aa2 (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
typedef struct JSONEl JSONEl;
typedef struct JSON 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 *);