xjson: serialize to/from JSON

Defined in xtensor/xjson.hpp

template<template<typename U, typename V, typename ...Args> class M, class E>
enable_xexpression<E> xt::to_json(nlohmann::basic_json<M> &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<template<typename U, typename V, typename ...Args> class M, class E>
enable_xcontainer_semantics<E> xt::from_json(const nlohmann::basic_json<M> &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