#include "rapidjson/document.h" using namespace rapidjson; int main() { const char* jsonStr = "[1, 2, 3, 4]"; Document doc; doc.Parse(jsonStr); if (doc.IsArray()) { // Do something if json is array } return 0; }
#includeIn both the above examples, we are checking whether the given JSON string is an array or not by using `isArray()` method of the respective C++ JSON library.using namespace Json; int main() { const char* jsonStr = "[1, 2, 3, 4]"; Value value; Reader reader; reader.parse(jsonStr, value); if (value.isArray()) { // Do something if json is array } return 0; }