mirror of
https://github.com/SatDump/SatDump
synced 2026-08-13 17:47:30 -04:00
24 lines
No EOL
423 B
C++
24 lines
No EOL
423 B
C++
#include "json.hpp"
|
|
#include <fstream>
|
|
#include <filesystem>
|
|
|
|
nlohmann::json loadJsonFile(std::string path)
|
|
{
|
|
nlohmann::json j;
|
|
|
|
if (std::filesystem::exists(path))
|
|
{
|
|
std::ifstream istream(path);
|
|
istream >> j;
|
|
istream.close();
|
|
}
|
|
|
|
return j;
|
|
}
|
|
|
|
void saveJsonFile(std::string path, nlohmann::json j)
|
|
{
|
|
std::ofstream ostream(path);
|
|
ostream << j.dump(4);
|
|
ostream.close();
|
|
} |