aboutsummaryrefslogtreecommitdiff
path: root/json.h
blob: 5f2f4c037e1bf1e09ebb1c8e181c37cbee3d5632 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

#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>
    ptrdiff_t len;
} JSONObject;
typedef struct {
  int *integer;
  Vec *array; // Vec<JSON>
  Str *string;
  JSONObject *object;
} JSON;
JSON* JSONObject_get(JSONObject *obj, Str key);
JSON JSON_parse(Arena *a, char *src);
JSON JSON_Int(Arena *a, int val);
#endif