9#include <nlohmann/json.hpp>
34 std::variant<std::string, std::vector<uint8_t>, nlohmann::json>;
64 const std::filesystem::path &file_path);
OutputFormat detect_format(const DataPayload &payload)
Detect format from payload type.
bool is_stdout_tty()
Check if stdout is a TTY (for format detection).
void write_to_file(const DataPayload &payload, const std::filesystem::path &file_path)
Write data to a file.
std::variant< std::string, std::vector< uint8_t >, nlohmann::json > DataPayload
Data payload that can be returned by routers.
OutputFormat
Output format types.
std::string json_to_text(const nlohmann::json &j)
Convert JSON to text (for scalar values).
void write_output(const DataPayload &payload, bool force_pretty=false)
Write data to stdout with appropriate formatting.