diff --git a/src/idl_gen_text.cpp b/src/idl_gen_text.cpp index e26d93ca5..52987af23 100644 --- a/src/idl_gen_text.cpp +++ b/src/idl_gen_text.cpp @@ -60,7 +60,12 @@ template void Print(T val, Type type, int /*indent*/, return; } } - text += NumToString(val); + + if (type.base_type == BASE_TYPE_BOOL) { + text += val ? "true" : "false"; + } else { + text += NumToString(val); + } } // Print a vector a sequence of JSON values, comma separated, wrapped in "[]". diff --git a/tests/test.cpp b/tests/test.cpp index 116068edd..be008180e 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -635,6 +635,11 @@ void FuzzTest2() { Dummy(); } break; + case flatbuffers::BASE_TYPE_BOOL: + AddToSchemaAndInstances("bool", deprecated + ? "" + : (lcg_rand() % 2 ? "true" : "false")); + break; default: // All the scalar types. schema += flatbuffers::kTypeNames[base_type];