patch 8.1.1158: json encoded string is sometimes missing the final NUL

Problem:    Json encoded string is sometimes missing the final NUL.
Solution:   Add the NUL.  Also for log messages.
diff --git a/src/json.c b/src/json.c
index d3c4817..9fb6af0 100644
--- a/src/json.c
+++ b/src/json.c
@@ -51,6 +51,7 @@
     /* Store bytes in the growarray. */
     ga_init2(&ga, 1, 4000);
     json_encode_gap(&ga, val, options);
+    ga_append(&ga, NUL);
     return ga.ga_data;
 }
 
@@ -82,6 +83,7 @@
     if (json_encode_gap(&ga, &listtv, options) == OK && (options & JSON_NL))
 	ga_append(&ga, '\n');
     list_unref(listtv.vval.v_list);
+    ga_append(&ga, NUL);
     return ga.ga_data;
 }
 #endif