diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2022-06-12 13:25:16 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2022-06-12 13:25:16 -0400 |
commit | 9caf88c263f2bee43e997cb70ca1e46a5d61517f (patch) | |
tree | e95665eb1d2a0c11764964a5b5f1984c10f36ebb /jdtalk.h | |
parent | 688289f1abb3fea7ee85cefccd9248fb9de0fe5c (diff) | |
download | jdtalkc-9caf88c263f2bee43e997cb70ca1e46a5d61517f.tar.gz |
Add error field to json output
Diffstat (limited to 'jdtalk.h')
-rw-r--r-- | jdtalk.h | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -24,14 +24,15 @@ #define WT_ADVERB 3 #define WT_VERB 4 -#define JSON_BEGIN(FP) fprintf(FP, "{\n"); +#define JSON_BEGIN(FP) fprintf(FP, "{\n") #define JSON_INDENT(FP, LEVEL) for (size_t indenter = 0; indenter < LEVEL; indenter++) { fprintf(FP, " "); } -#define JSON_NEXT_ITEM(FP) fprintf(FP, ",\n"); -#define JSON_NEXT_LINE(FP) fprintf(FP, "\n"); -#define JSON_LIST_BEGIN(FP, KEY) JSON_INDENT(FP, 1); fprintf(FP, "\"%s\": [", KEY); -#define JSON_LIST_APPEND(FP, VALUE) JSON_INDENT(FP, 2); fprintf(FP, "\"%s\"", VALUE); -#define JSON_LIST_END(FP) fprintf(FP, "]\n"); -#define JSON_END(FP) fprintf(FP, "}\n"); +#define JSON_NEXT_ITEM(FP) fprintf(FP, ",\n") +#define JSON_NEXT_LINE(FP) fprintf(FP, "\n") +#define JSON_LIST_BEGIN(FP, KEY) JSON_INDENT(FP, 1); fprintf(FP, "\"%s\": [", KEY) +#define JSON_LIST_APPEND(FP, VALUE) JSON_INDENT(FP, 2); fprintf(FP, "\"%s\"", VALUE) +#define JSON_LIST_END(FP) fprintf(FP, "]") +#define JSON_STRING(FP, KEY, VALUE) JSON_INDENT(FP, 1); fprintf(FP, "\"%s\": \"%s\"", KEY, VALUE) +#define JSON_END(FP) fprintf(FP, "}\n") struct Word { char *word; |