# Other types¶

Some types that are not used to store settings require different to_json and from_json implementations. If these types are prone to be used in different parts of the json_interface, their to_json and from_json should be declared in Tudat/JsonInterface/Support/valueConversions.h. As discussed previously, there are already some functions in that file, such as custom implementations for std::map and std::unordered_map that ignore the special keys, for std::vector containing non-primitive types, and for Eigen::Matrix.

Additionally, there are functions for std::complex, so that the following is possible:

nlohmann::json j = "(1,-0.5)";
std::complex< double > complexNumber = j;         // 1 - 0.5i


For std::pair:

nlohmann::json j = R"(
[
6,
"keplerian"
]
)"_json;
std::pair< int, std::string > pair = j;         // { 6, "keplerian" }


And for Eigen::Quaterniond, so that it can be created directly from an Eigen::Matrix3d when the provided nlohmann::json object is of value type array, or using the function spice_interface::computeRotationQuaternionBetweenFrames when it is of value type object. Thus, it is possible to create an Eigen::Quaterniond from any of these two JSON files:

[
[ 1,  0,  0 ],
[ 0,  1, -1 ],
[ 0, -1,  1 ]
]

{
"originalFrame": "ECLIPJ2000",
"targetFrame": "IAU_Earth",
"initialTime": 0
}