xjson: serialize to/from JSON

Defined in xtensor/xjson.hpp

template<class E>
enable_xexpression<E> xt::to_json(nlohmann::json &j, const E &e)

JSON serialization of an xtensor expression.

The to_json method is used by the nlohmann_json package for automatic serialization of user-defined types. The method is picked up by argument-dependent lookup.

Parameters

template<class E>
enable_xcontainer_semantics<E> xt::from_json(const nlohmann::json &j, E &e)

JSON deserialization of a xtensor expression with a container or a view semantics.

The from_json method is used by the nlohmann_json library for automatic serialization of user-defined types. The method is picked up by argument-dependent lookup.

Note: for converting a JSON object to a value, nlohmann_json requires the value type to be default constructible, which is typically not the case for expressions with a view semantics. In this case, from_json can be called directly.

Parameters