Skip to content

Distribute and run LLMs with a single file.

Fix JSON parser bug

Justine Tunneyfb4b3e6e454d
diff --git a/llamafile/server/json.cpp b/llamafile/server/json.cpp
index 4cd4ba5a..6a78bf24 100644
--- a/llamafile/server/json.cpp
+++ b/llamafile/server/json.cpp
@@ -951,6 +951,8 @@ Json::parse(Json& json, const char*& p, const char* e, int context, int depth)
return success;
if (status != success)
return status;
+ if (!key.isString())
+ return object_key_must_be_string;
status = parse(value, p, e, COLON, depth - 1);
if (status == absent_value)
return object_missing_value;