From dfeae229a0950c298ba0996b379996f10b43d1ff Mon Sep 17 00:00:00 2001 From: Nia Bickford Date: Thu, 3 Sep 2026 02:07:38 +0200 Subject: [PATCH 1/2] Enable parsing comments when using the TinyGLTF or RapidJSON loaders Signed-off-by: Nia Bickford --- tiny_gltf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index ab6d5c80..b67b5524 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -2119,9 +2119,9 @@ void JsonParse(JsonDocument &doc, const char *str, size_t length, bool throwExc = false) { #ifdef TINYGLTF_USE_RAPIDJSON (void)throwExc; - doc.Parse(str, length); + doc.Parse(str, length); #else - doc = detail::json::parse(str, str + length, nullptr, throwExc); + doc = detail::json::parse(str, str + length, nullptr, throwExc, true); #endif } #endif // !TINYGLTF_USE_CUSTOM_JSON From 74ce47110a4ed0233e64f348eb3cc65a434a0f71 Mon Sep 17 00:00:00 2001 From: Nia Bickford Date: Thu, 3 Sep 2026 13:43:54 +0200 Subject: [PATCH 2/2] Also handle trailing commas Signed-off-by: Nia Bickford --- tiny_gltf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index b67b5524..777fdef8 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -2119,9 +2119,9 @@ void JsonParse(JsonDocument &doc, const char *str, size_t length, bool throwExc = false) { #ifdef TINYGLTF_USE_RAPIDJSON (void)throwExc; - doc.Parse(str, length); + doc.Parse(str, length); #else - doc = detail::json::parse(str, str + length, nullptr, throwExc, true); + doc = detail::json::parse(str, str + length, nullptr, throwExc, true, true); #endif } #endif // !TINYGLTF_USE_CUSTOM_JSON