I recently found out that nlohmann/json runs on C++ 11. Otherwise it gives some syntax error due to a deprecated line from using a higher C++ version.
bazel-out/k8-opt/bin/examples/collaboration_station/_virtual_includes/manipulation_station/drake/examples/manipulation_station/include/json.hpp:2149:30: error: redundant redeclaration of 'constexpr' static data member 'nlohmann::detail::static_const<T>::value' [-Werror=deprecated]
constexpr T static_const<T>::value;
^~~~~
bazel-out/k8-opt/bin/examples/collaboration_station/_virtual_includes/manipulation_station/drake/examples/manipulation_station/include/json.hpp:2145:24: note: previous declaration of 'nlohmann::detail::static_const<T>::value'
static constexpr T value{};
I was able to run a normal c++ file with nlohmann by using the key term
bazel run --cxxopt='-std=c++11
However, if I incorporate drake into my example, it does not run (most likely due to a low C++ version)
In order to test out nlohmann/json, I took their json.hpp file located under json/single_include/nlohmann/json.hpp on their github page. I made sure to #include the json file.
Is there an easy way to incorporate nlohmann/json or any other type of json reader into drake?