Software

The library is part of major linux distributions like Ubuntu, Debian, Arch Linux, Fedora, Alpine and as a FreeBSD package. It is in Microsoft vcpkg. It is available as an MSYS2 package, from brew and from conan. We publish it as single-header library as well as a CMake build from the GitHub repository. We have a simdjson organization on GitHub.

Quick Start

Prerequisites: a recent C++ compiler.

  1. Pull simdjson.h and simdjson.cpp from our singleheader directory into a directory of your choice, along with the sample file twitter.json from our jsonexamples repository.
SIMDJSON_BASE="https://raw.githubusercontent.com/simdjson/simdjson/master/"

wget "${SIMDJSON_BASE}singleheader/simdjson.h" \
     "${SIMDJSON_BASE}singleheader/simdjson.cpp" \
     "${SIMDJSON_BASE}jsonexamples/twitter.json"
  1. Create quickstart.cpp:
   #include "simdjson.h"
   using namespace simdjson;
   int main(void) {
      ondemand::parser parser;
      padded_string json = padded_string::load("twitter.json");
      ondemand::document tweets = parser.iterate(json);
      std::cout << uint64_t(tweets["search_metadata"]["count"]) 
        << " results." << std::endl;
   }
  1. Compile:

       c++ -o quickstart quickstart.cpp simdjson.cpp -std=c++17

  2. Run:

       ./quickstart

Documentation

Usage documentation is available:

  • Basics is an overview of how to use simdjson and its APIs.
  • Builder is an overview of how to efficiently write JSON strings using simdjson.
  • Performance shows some more advanced scenarios and how to tune for them.
  • Implementation Selection Selection describes runtime CPU detection and how you can work with it.

Real-world usage

If you are planning to use simdjson in a product, please work from one of our releases.

Bindings and Ports of simdjson

We distinguish between “bindings” (which just wrap the C++ code) and a port to another programming language (which reimplements everything).

Morty Proxy This is a proxified and sanitized view of the page, visit original site.