MCPcopy Create free account
hub / github.com/LAStools/LAStools / json_assign

Function json_assign

src/lasinfo.cpp:243–255  ·  view source on GitHub ↗

Assigns a variant Value to a JSON field, converting CsvString to plain text for JSON compatibility

Source from the content-addressed store, hash-verified

241
242/// Assigns a variant Value to a JSON field, converting CsvString to plain text for JSON compatibility
243static 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
258static void add_field(const std::string& key, const Value& value, bool json_out, bool csv_out, JsonObject& json, FileMap& file_csv) {

Callers 2

add_fieldFunction · 0.85
add_field_fullFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected