1 #include <stdio.h> 2 #include "j2s.h" 3 #include "j2s_generated_template_json.h" 4 main(int argc,char ** argv)5int main(int argc, char** argv) { 6 j2s_ctx ctx; 7 char *buf; 8 int ret = -1; 9 FILE* json_file = NULL; 10 11 j2s_init(&ctx); 12 ctx.format_json = true; 13 ctx.dump_desc = true; 14 15 printf("Dump template JSON\n"); 16 buf = j2s_dump_template_root_struct(&ctx); 17 DASSERT(buf, goto err); 18 printf("Result:\n%s\n", buf); 19 free(buf); 20 21 json_file = fopen("rkaiq_ui_template.json","w"); 22 fprintf(json_file, "%s\n", _j2s_template_json); 23 printf("Dump template JSON:\n%s\n", _j2s_template_json); 24 25 err: 26 fclose(json_file); 27 j2s_deinit(&ctx); 28 return ret; 29 } 30