[![JSON for Modern C++](https://raw.githubusercontent.com/nlohmann/json/master/doc/json.gif)](https://github.com/nlohmann/json/releases)
[![Build Status](https://travis-ci.org/nlohmann/json.svg?branch=master)](https://travis-ci.org/nlohmann/json)
[![Build Status](https://ci.appveyor.com/api/projects/status/1acb366xfyg3qybk/branch/develop?svg=true)](https://ci.appveyor.com/project/nlohmann/json)
[![Ubuntu](https://github.com/nlohmann/json/workflows/Ubuntu/badge.svg)](https://github.com/nlohmann/json/actions?query=workflow%3AUbuntu)
[![macOS](https://github.com/nlohmann/json/workflows/macOS/badge.svg)](https://github.com/nlohmann/json/actions?query=workflow%3AmacOS)
[![Windows](https://github.com/nlohmann/json/workflows/Windows/badge.svg)](https://github.com/nlohmann/json/actions?query=workflow%3AWindows)
[![Coverage Status](https://coveralls.io/repos/github/nlohmann/json/badge.svg?branch=develop)](https://coveralls.io/github/nlohmann/json?branch=develop)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/5550/badge.svg)](https://scan.coverity.com/projects/nlohmann-json)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/f3732b3327e34358a0e9d1fe9f661f08)](https://www.codacy.com/app/nlohmann/json?utm_source=github.com&utm_medium=referral&utm_content=nlohmann/json&utm_campaign=Badge_Grade)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/nlohmann/json.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/nlohmann/json/context:cpp)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/json.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:json)
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/3lCHrFUZANONKv7a)
[![Documentation](https://img.shields.io/badge/docs-doxygen-blue.svg)](https://nlohmann.github.io/json/doxygen/index.html)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/nlohmann/json/master/LICENSE.MIT)
[![GitHub Releases](https://img.shields.io/github/release/nlohmann/json.svg)](https://github.com/nlohmann/json/releases)
[![GitHub Downloads](https://img.shields.io/github/downloads/nlohmann/json/total)](https://github.com/nlohmann/json/releases)
[![GitHub Issues](https://img.shields.io/github/issues/nlohmann/json.svg)](https://github.com/nlohmann/json/issues)
[![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/nlohmann/json.svg)](https://isitmaintained.com/project/nlohmann/json "Average time to resolve an issue")
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/289/badge)](https://bestpractices.coreinfrastructure.org/projects/289)
[![GitHub Sponsors](https://img.shields.io/badge/GitHub-Sponsors-ff69b4)](https://github.com/sponsors/nlohmann)
- [Design goals](#design-goals)
- [Sponsors](#sponsors)
- [Integration](#integration)
- [CMake](#cmake)
- [Package Managers](#package-managers)
- [Pkg-config](#pkg-config)
- [Examples](#examples)
- [JSON as first-class data type](#json-as-first-class-data-type)
- [Serialization / Deserialization](#serialization--deserialization)
- [STL-like access](#stl-like-access)
- [Conversion from STL containers](#conversion-from-stl-containers)
- [JSON Pointer and JSON Patch](#json-pointer-and-json-patch)
- [JSON Merge Patch](#json-merge-patch)
- [Implicit conversions](#implicit-conversions)
- [Conversions to/from arbitrary types](#arbitrary-types-conversions)
- [Specializing enum conversion](#specializing-enum-conversion)
- [Binary formats (BSON, CBOR, MessagePack, and UBJSON)](#binary-formats-bson-cbor-messagepack-and-ubjson)
- [Supported compilers](#supported-compilers)
- [License](#license)
- [Contact](#contact)
- [Thanks](#thanks)
- [Used third-party tools](#used-third-party-tools)
- [Projects using JSON for Modern C++](#projects-using-json-for-modern-c)
- [Notes](#notes)
- [Execute unit tests](#execute-unit-tests)
## Design goals
There are myriads of [JSON](https://json.org) libraries out there, and each may even have its reason to exist. Our class had these design goals:
- **Intuitive syntax**. In languages such as Python, JSON feels like a first class data type. We used all the operator magic of modern C++ to achieve the same feeling in your code. Check out the [examples below](#examples) and you'll know what I mean.
- **Trivial integration**. Our whole code consists of a single header file [`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp). That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings.
- **Serious testing**. Our class is heavily [unit-tested](https://github.com/nlohmann/json/tree/develop/test/src) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](https://valgrind.org) and the [Clang Sanitizers](https://clang.llvm.org/docs/index.html) that there are no memory leaks. [Google OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/json) additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the [Core Infrastructure Initiative (CII) best practices](https://bestpractices.coreinfrastructure.org/projects/289).
Other aspects were not so important to us:
- **Memory efficiency**. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: `std::string` for strings, `int64_t`, `uint64_t` or `double` for numbers, `std::map` for objects, `std::vector` for arrays, and `bool` for Booleans. However, you can template the generalized class `basic_json` to your needs.
- **Speed**. There are certainly [faster JSON libraries](https://github.com/miloyip/nativejson-benchmark#parsing-time) out there. However, if your goal is to speed up your development by adding JSON support with a single header, then this library is the way to go. If you know how to use a `std::vector` or `std::map`, you are already set.
See the [contribution guidelines](https://github.com/nlohmann/json/blob/master/.github/CONTRIBUTING.md#please-dont) for more information.
## Sponsors
You can sponsor this library at [GitHub Sponsors](https://github.com/sponsors/nlohmann).
### :label: Named Sponsors
- [Michael Hartmann](https://github.com/reFX-Mike)
- [Stefan Hagen](https://github.com/sthagen)
- [Steve Sperandeo](https://github.com/homer6)
- [Robert Jefe Lindstädt](https://github.com/eljefedelrodeodeljefe)
- [Steve Wagner](https://github.com/ciroque)
Thanks everyone!
## Integration
[`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) is the single required file in `single_include/nlohmann` or [released here](https://github.com/nlohmann/json/releases). You need to add
```cpp
#include <nlohmann/json.hpp>
// for convenience
using json = nlohmann::json;
```
to the files you want to process JSON and set the necessary switches to enable C++11 (e.g., `-std=c++11` for GCC and Clang).
You can further use file [`include/nlohmann/json_fwd.hpp`](https://github.com/nlohmann/json/blob/develop/include/nlohmann/json_fwd.hpp) for forward-declarations. The installation of json_fwd.hpp (as part of cmake's install step), can be achieved by setting `-DJSON_MultipleHeaders=ON`.
### CMake
You can also use the `nlohmann_json::nlohmann_json` interface target in CMake. This target populates the appropriate usage requirements for `INTERFACE_INCLUDE_DIRECTORIES` to point to the appropriate include directories and `INTERFACE_COMPILE_FEATURES` for the necessary C++11 flags.
#### External
To use this library from a CM
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
面向 L5 自主飞行的 eVTOL 与无人机,提供稳健强大基于激光雷达的全自主飞行开源平台。GAAS是一个开源程序,专为完全自主的VTOL(又名飞行汽车)和无人机而设计。GAAS 代表 广义自治航空系统。GAAS为飞机提供了基于激光雷达、高清地图重新定位、路径规划等模块的全自主飞行平台。与以前仅适用于消费级无人机的自动驾驶技术相比,GAAS旨在为载人提供强大的全自动飞行,并且可以很容易地与国家空中交通管制相结合。在GAAS上,您可以看到许多以前仅在自动驾驶汽车中可用的汽车级(AG)技术。整个框架是松散耦合的,因此您可以自定义自己的模块并轻松地将它们添加到 GAAS 中。
资源推荐
资源详情
资源评论
收起资源包目录
面向 L5 自主飞行的 eVTOL 与无人机,提供稳健强大基于激光雷达的全自主飞行开源平台 (2000个子文件)
vcf.c 99KB
cram_io.c 88KB
cram_encode.c 71KB
deflate.c 70KB
cram_decode.c 56KB
sam.c 54KB
inflate.c 52KB
lz4frame.c 51KB
divsufsort.c 50KB
lz4.c 48KB
trees.c 43KB
cram_codecs.c 42KB
synced_bcf_reader.c 38KB
hts.c 38KB
bgzf.c 31KB
sam_header.c 27KB
xxhash.c 26KB
lz4hc.c 26KB
vcfutils.c 24KB
infback.c 22KB
psa_sequences.c 22KB
gzread.c 18KB
knetfile.c 18KB
thread_pool.c 16KB
gzlib.c 15KB
gzwrite.c 15KB
mFILE.c 15KB
hfile.c 14KB
inffast.c 13KB
tabix.c 13KB
crc32.c 13KB
inftrees.c 13KB
cram_index.c 12KB
vlen.c 12KB
open_trace_file.c 11KB
faidx.c 11KB
cram_stats.c 9KB
bgzip.c 9KB
checksum.c 8KB
md5.c 8KB
kfunc.c 8KB
tbx.c 8KB
zutil.c 7KB
psa_swgotoh_ref_2b_gpu.c 7KB
psa_swgotoh_cpu.c 6KB
psa_regions.c 6KB
genRegions.c 6KB
psa_swgotoh_2b_gpu.c 6KB
kstring.c 6KB
suftest.c 5KB
psa_profile.c 5KB
adler32.c 5KB
zfio.c 5KB
cram_samtools.c 5KB
vcf_sweep.c 4KB
pooled_alloc.c 4KB
string_alloc.c 4KB
psa_swwozniak_gpu.c 4KB
psa_swfarrar_gpu.c 4KB
psa_alignments.c 4KB
benchmark.c 3KB
hfile_net.c 3KB
compress.c 2KB
files.c 2KB
uncompr.c 2KB
StandaloneFuzzTargetMain.c 2KB
psa_errors.c 1KB
psa_time.c 689B
gzclose.c 678B
unit-cbor.cpp 129KB
unit-ubjson.cpp 112KB
unit-testsuites.cpp 103KB
unit-class_parser.cpp 90KB
unit-msgpack.cpp 88KB
stats.cpp 63KB
unit-unicode.cpp 61KB
unit-conversions.cpp 59KB
unit-element_access2.cpp 59KB
unit-regression1.cpp 57KB
unit-iterators2.cpp 55KB
unit-constructor1.cpp 55KB
unit-iterators1.cpp 52KB
unit-json_patch.cpp 48KB
unit-element_access1.cpp 46KB
unit-bson.cpp 45KB
nvBowtie.cpp 43KB
unit-deserialization.cpp 42KB
pe_analyzer.cpp 42KB
unit-items.cpp 36KB
BamReader.cpp 35KB
unit-to_chars.cpp 35KB
unit-modifiers.cpp 34KB
unit-json_pointer.cpp 28KB
FuzzerUnittest.cpp 28KB
se_analyzer.cpp 28KB
Octree.cpp 26KB
FuzzerLoop.cpp 25KB
NormalDistributionsTransform.cpp 24KB
VoxelGrid.cpp 24KB
unit-udt.cpp 22KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6713
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功