2022-11-02 00:05:01 +01:00
|
|
|
#ifndef JSON_HEADER
|
|
|
|
#define JSON_HEADER
|
2022-11-08 23:31:00 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2022-11-02 00:05:01 +01:00
|
|
|
#include "sortedmap.h"
|
|
|
|
#include "arraylist.h"
|
2022-11-08 23:31:00 +01:00
|
|
|
|
2022-11-04 08:21:05 +01:00
|
|
|
enum jsontype { NIL, BOOLEAN, STRING, NUMBER, LIST, MAP };
|
2022-11-02 00:05:01 +01:00
|
|
|
|
|
|
|
typedef struct json {
|
|
|
|
enum jsontype type;
|
|
|
|
union {
|
|
|
|
int boolean;
|
|
|
|
char * string;
|
|
|
|
double number;
|
|
|
|
ArrayList * list;
|
|
|
|
SortedMap * map;
|
|
|
|
} value;
|
|
|
|
} Json;
|
|
|
|
|
|
|
|
Json * json_parse(FILE *stream);
|
|
|
|
void json_print(Json *this, FILE *stream);
|
|
|
|
void json_free(Json *this);
|
|
|
|
#endif
|