aboutsummaryrefslogtreecommitdiff
path: root/json.h
blob: 99e3e758889b6d3c01ab05b91d703f5d21ba1da7 (plain) (blame)
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

#ifndef JSON_H
#define JSON_H
#include "memory.h"
#include "string.h"
#include "vec.h"

typedef struct {
    Vec keys;   // Vec<Str>
    Vec values; // Vec<JSON>
    size len;
} JSONObject;
typedef struct {
    i32 *boolean;
    i32 *integer;
    f32 *floating;
    Vec *array; // Vec<JSON>
    Str *string;
    void *null;
    JSONObject *object;
} JSON;
JSON *JSONObject_get(JSONObject *obj, Str key);
i32 JSON_fprint(FILE *w, JSON json);
JSON JSON_parse(Arena *a, byte *src);
JSON JSON_Int(Arena *a, i32 val);
#endif