diff --git a/src/post_modules/JSON/json.cmod b/src/post_modules/JSON/json.cmod
index 95523217dbad31f330e14db82ab1209414505c40..5fb52b11c0979a68f02497ebdb551eba4139aba1 100644
--- a/src/post_modules/JSON/json.cmod
+++ b/src/post_modules/JSON/json.cmod
@@ -214,6 +214,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');
@@ -300,6 +301,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;