Giter VIP home page Giter VIP logo

pybind11_json's Introduction

Travis Build status

pybind11_json

pybind11_json is an nlohmann::json to pybind11 bridge, it allows you to automatically convert nlohmann::json to py::object and the other way around:

#include "pybind11_json/pybind11_json.hpp"

#include "nlohmann/json.hpp"

#include "pybind11/pybind11.h"

namespace py = pybind11;
namespace nl = nlohmann;
using namespace pybind11::literals;

py::object obj = py::dict("number"_a=1234, "hello"_a="world");

nl::json j = obj;  // Automatic py::object->nl::json conversion
py::object o = j;  // Automatic nl::json->py::object conversion

Installation

Using conda

You can install pybind11_json using conda

conda install -c conda-forge pybind11 nlohmann_json pybind11_json

From sources

We encourage you to use conda for installing dependencies, but it is not a requirement for pybind11_json to work

conda install cmake nlohmann_json pybind11 -c conda-forge

Then you can install the sources

cmake -D CMAKE_INSTALL_PREFIX=your_conda_path
make install

Run tests

You can compile and run tests locally doing

cmake -D CMAKE_INSTALL_PREFIX=$CONDA_PREFIX -D DOWNLOAD_GTEST=ON ..
make
./test/test_pybind11_json

Dependencies

pybind11_json depends on

pybind11_json nlohmann_json pybind11
master >=3.2.0,<4.0 >=2.2.4,<3.0
0.2.2 >=3.2.0,<4.0 >=2.2.4,<3.0
0.2.1 >=3.2.0,<4.0 >=2.2.4,<3.0
0.2.0 >=3.2.0,<4.0 >=2.2.4,<3.0
0.1.0 >=3.2.0,<4.0 >=2.2.4,<3.0

License

We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.

This software is licensed under the BSD-3-Clause license. See the LICENSE file for details.

pybind11_json's People

Contributors

martinrenou avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.