summaryrefslogtreecommitdiffstats
path: root/src/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/json.c b/src/json.c
index 84bdaa39..bb1d0f2d 100644
--- a/src/json.c
+++ b/src/json.c
@@ -770,12 +770,13 @@ static json_t *datatype_json(const struct expr *expr, struct output_ctx *octx)
return symbolic_constant_json(dtype->sym_tbl,
expr, octx);
if (dtype->print) {
- struct output_ctx octx = { .numeric = 3 };
char buf[1024];
+ FILE *ofp = octx->output_fp;
- octx.output_fp = fmemopen(buf, 1024, "w");
- dtype->print(expr, &octx);
- fclose(octx.output_fp);
+ octx->output_fp = fmemopen(buf, 1024, "w");
+ dtype->print(expr, octx);
+ fclose(octx->output_fp);
+ octx->output_fp = ofp;
if (buf[0] == '"') {
memmove(buf, buf + 1, strlen(buf));