2#include "../json_helper.h"
9 j[
"nodes"] = json::array();
10 for (
size_t i = 0;
i <
nodes.size(); ++
i)
18 j[
"nodes"].push_back(
nj);
ComponentTypeID GetComponentTypeID_Static()
std::string GetString(const json &j, const std::string &key, const std::string &defaultValue="")
Safely get a string value from JSON.
int GetInt(const json &j, const std::string &key, int defaultValue=0)
Safely get an integer value from JSON.
void ForEachInArray(const json &j, const std::string &key, std::function< void(const json &, size_t)> callback)
Iterate over an array with a callback function.
float GetFloat(const json &j, const std::string &key, float defaultValue=0.0f)
Safely get a float value from JSON.
bool IsArray(const json &j, const std::string &key)
Check if a key contains an array.
std::vector< Node > nodes
static Graph FromJson(const nlohmann::json &j)
nlohmann::json ToJson() const