diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 12c63cf370..508567d1b7 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -1070,16 +1070,15 @@ void OpenSpaceEngine::writeDocumentation() { sceneGraph["Name"] = "Scene"; sceneGraph["Data"] = scene.get(); - nlohmann::json documentation; - documentation["documentation"].push_back(sceneGraph); - documentation["documentation"].push_back(sceneProperties); - documentation["documentation"].push_back(keybindings); - documentation["documentation"].push_back(license); - documentation["documentation"].push_back(scripting); - documentation["documentation"].push_back(factory); + nlohmann::json documentation = { + sceneGraph, sceneProperties, keybindings, license, scripting, factory + }; + + nlohmann::json result; + result["documentation"] = documentation; std::ofstream out(absPath("${DOCUMENTATION}/documentationData.js")); - out << "var data = " << documentation.dump(); + out << "var data = " << result.dump(); out.close(); } diff --git a/src/scripting/scriptengine.cpp b/src/scripting/scriptengine.cpp index 5de084f808..fd29c07b07 100644 --- a/src/scripting/scriptengine.cpp +++ b/src/scripting/scriptengine.cpp @@ -99,16 +99,17 @@ namespace { using namespace openspace::scripting; nlohmann::json function; function["Name"] = f.name; - function["Arguments"] = nlohmann::json::array(); + nlohmann::json arguments = nlohmann::json::array(); for (const LuaLibrary::Function::Argument& arg : f.arguments) { nlohmann::json argument; argument["Name"] = arg.name; argument["Type"] = arg.type; argument["Default Value"] = arg.defaultValue.value_or(""); - function["Arguments"].push_back(argument); + arguments.push_back(argument); } + function["Arguments"] = arguments; function["Return Type"] = f.returnType; function["Help"] = f.helpText;