A basic JSON Parser written in C Lang
Add parser.h and parser.c in the project
#include "parser.h"
int main() {
char *string; // JSON string to be parsed
parser p;
initParser(&p, string);
JsonValue *value = parseJson(&p);
if (value == NULL)
{
printParseError(&p);
}
else
{
printJsonValue(value, 0);
freeJsonValue(value);
}
return 0;
}
run make all
run ./bin/demo ./inputs/t0.json