diff --git a/src/post_modules/JSON/json.cmod b/src/post_modules/JSON/json.cmod
index 396fca9e897dfcfaa45f5665b13f144f3bc17760..d47b5d9c1b6b200b16264381efd54d63ba1ba798 100644
--- a/src/post_modules/JSON/json.cmod
+++ b/src/post_modules/JSON/json.cmod
@@ -211,6 +211,7 @@ static void encode_mapcont_canon (struct encode_context *ctx, struct mapping *m)
 
     if (notfirst) {
       int indent = ctx->indent;
+      fast_check_threads_etc(8);
       string_builder_putchar (buf, ',');
       if (indent >= 0) {
 	string_builder_putchar (buf, '\n');
@@ -293,6 +294,7 @@ static void json_encode_recur (struct encode_context *ctx, struct svalue *val)
 	  }
 	  json_encode_recur (ctx, ITEM (a));
 	  for (i = 1; i < size; i++) {
+	    fast_check_threads_etc(8);
 	    string_builder_putchar (buf, ',');
 	    if (ctx->indent >= 0) {
 	      int indent = ctx->indent;