Update for jart/json.cpp change

This commit is contained in:
Peter Johnson
2026-03-29 15:38:18 -07:00
parent de3e211fdb
commit 9ca93fa190
120 changed files with 1240 additions and 1087 deletions

View File

@@ -8,14 +8,15 @@
void wpi::math::to_json(wpi::util::json& json,
const Translation3d& translation) {
json = wpi::util::json{{"x", translation.X().value()},
{"y", translation.Y().value()},
{"z", translation.Z().value()}};
json.set_object();
json["x"] = translation.X().value();
json["y"] = translation.Y().value();
json["z"] = translation.Z().value();
}
void wpi::math::from_json(const wpi::util::json& json,
Translation3d& translation) {
translation = Translation3d{wpi::units::meter_t{json.at("x").get<double>()},
wpi::units::meter_t{json.at("y").get<double>()},
wpi::units::meter_t{json.at("z").get<double>()}};
translation = Translation3d{wpi::units::meter_t{json.at("x").get_number()},
wpi::units::meter_t{json.at("y").get_number()},
wpi::units::meter_t{json.at("z").get_number()}};
}