Assigns a variant Value to a JSON field, converting CsvString to plain text for JSON compatibility
| 241 | |
| 242 | /// Assigns a variant Value to a JSON field, converting CsvString to plain text for JSON compatibility |
| 243 | static void json_assign(JsonObject& json, const std::string& key, const Value& value) { |
| 244 | std::visit( |
| 245 | [&](auto&& v) { |
| 246 | using T = std::decay_t<decltype(v)>; |
| 247 | |
| 248 | if constexpr (std::is_same_v<T, CsvString>) { |
| 249 | json[key] = v.text; // json always receives only the plain string |
| 250 | } else { |
| 251 | json[key] = v; |
| 252 | } |
| 253 | }, |
| 254 | value); |
| 255 | } |
| 256 | |
| 257 | /// Adds a field (object) to the json object or the csv data container |
| 258 | static void add_field(const std::string& key, const Value& value, bool json_out, bool csv_out, JsonObject& json, FileMap& file_csv) { |
no outgoing calls
no test coverage detected