]> git.lizzy.rs Git - plan9front.git/blob - sys/include/json.h
merge
[plan9front.git] / sys / include / json.h
1 #pragma src "/sys/src/libjson"
2 #pragma lib "libjson.a"
3
4 typedef struct JSONEl JSONEl;
5 typedef struct JSON JSON;
6
7 #pragma varargck type "J" JSON*
8
9 enum {
10         JSONNull,
11         JSONBool,
12         JSONNumber,
13         JSONString,
14         JSONArray,
15         JSONObject,
16 };
17
18 struct JSONEl {
19         char *name;
20         JSON *val;
21         JSONEl *next;
22 };
23
24 struct JSON
25 {
26         int t;
27         union {
28                 double n;
29                 char *s;
30                 JSONEl *first;
31         };
32 };
33
34 JSON*   jsonparse(char *);
35 void    jsonfree(JSON *);
36 JSON*   jsonbyname(JSON *, char *);
37 char*   jsonstr(JSON *);
38 int     JSONfmt(Fmt*);
39 void    JSONfmtinstall(void);