How do I run a piece of C code through JavaScript?

Viewed 38

I have a piece of HTML/JS code that runs on a local server. When the server is started by the user, I want to have a parser I have written (in C) parse through a file. The parser works fine on its own. It looks through a text file in a custom format and outputs its data to a struct. The input looks like this:

MOVIENAME: [ACTOR1, ACTOR2 (OPTIONAL), ACTOR3 (OPTIONAL)], DIRECTOR, YEAR, GENRE

It stores it in a struct that looks like this:

typedef char* spg_person;
typedef spg_person spg_actor;
typedef spg_person spg_director;
typedef char* spg_genre;
typedef char* spg_tag;
typedef int spg_year;

typedef struct _movie {
    char* title;
    spg_actor* actor;
    spg_genre genre;
    spg_year year;
    spg_director director;
} movie;

I have heard of JSON files, but I'm not sure how convert.

Thanks

0 Answers
Related