plan9fox/sys/include/json.h

40 lines
520 B
C
Raw Normal View History

#pragma src "/sys/src/libjson"
#pragma lib "libjson.a"
2012-06-08 21:48:41 +00:00
typedef struct JSONEl JSONEl;
typedef struct JSON JSON;
#pragma varargck type "J" JSON*
2012-06-08 21:48:41 +00:00
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);