pxJson.h 629 B

123456789101112131415161718192021222324252627
  1. #ifndef _PX_JSON_H_
  2. #define _PX_JSON_H_
  3. #include <stdio.h>
  4. #include <sys/file.h>
  5. #include "cJSON.h"
  6. typedef struct JSONFILE
  7. {
  8. FILE *fd;
  9. cJSON *body_json;
  10. }JSONFILE_S;
  11. JSONFILE_S *JsonFileOpen(char *path,char *file);
  12. void JsonFileSet(JSONFILE_S * jf,cJSON *obj,char *name, ...);
  13. void JsonFileClose(JSONFILE_S * jf);
  14. #define JsonFileWrite(path,file,obj,name...) \
  15. do{\
  16. JSONFILE_S *jf=JsonFileOpen(path,file);\
  17. JsonFileSet(jf,obj,##name);\
  18. JsonFileClose(jf);\
  19. }while(0);
  20. char* JsonGetStr(cJSON* json,char *name);
  21. void JsonFillStrArry(cJSON* json,char *name,char ***value);
  22. #endif