Skip to content

Davphla/JSON-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON Parser in C

Here's an entirely hand made JSON Parser made in C made for Epitech's project !
It was made and well used for the my_rpg project in order to get scripting working (Using Tiled as a map editor). 🙂

ReadMe Card

How it works

This was all made using linked list and the super well explained JSON Website that explains pretty much everything behind this parser.
All the present function are based from this website, and pretty much just adapted from it

Main function

Checker :

pars_data_t *parser_json(char *filepath); // Used to transform any .json into a pars_data_t linked_list structures
void pars_data_destroy(pars_data_t *data); // Destroy and free the linked list

pars_data_t *json_search(pars_data_t *data, const char *to_find); // Gets the pointer to the corresponding data_name structures, or return NULL

Writer :

int writer_json(char *filepath, pars_obj_t *obj, pars_data_t *data); // Used to transform any pars_data_t struct into a .json file

Data structures :

typedef union values_s {
    int kint;
    double kfloat;
    char *kstr;
    pars_data_t *kobj;
} values_t;

typedef struct pars_data_s {
    char *data_name;
    type_t type;
    values_t values;
    struct pars_data_s *next;
} pars_data_t;

Maintainer

Davphla

About

JSON Parser made for Epitech Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published