26 lines
438 B
C
26 lines
438 B
C
#ifndef JSON_HEADER
|
|
#define JSON_HEADER
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "sortedmap.h"
|
|
#include "arraylist.h"
|
|
|
|
enum jsontype { NIL, BOOLEAN, STRING, NUMBER, LIST, MAP };
|
|
|
|
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
|