forked from arcbtc/bitcoinSwitch
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
471 changed files
with
51,854 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// ArduinoJson - https://arduinojson.org | ||
// Copyright © 2014-2022, Benoit BLANCHON | ||
// MIT License | ||
|
||
#include "src/ArduinoJson.h" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# ArduinoJson - https://arduinojson.org | ||
# Copyright © 2014-2022, Benoit BLANCHON | ||
# MIT License | ||
|
||
cmake_minimum_required(VERSION 3.15) | ||
|
||
if(ESP_PLATFORM) | ||
# Build ArduinoJson as an ESP-IDF component | ||
idf_component_register(INCLUDE_DIRS src) | ||
return() | ||
endif() | ||
|
||
project(ArduinoJson VERSION 6.19.0) | ||
|
||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) | ||
include(CTest) | ||
endif() | ||
|
||
add_subdirectory(src) | ||
|
||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) | ||
include(extras/CompileOptions.cmake) | ||
add_subdirectory(extras/tests) | ||
add_subdirectory(extras/fuzzing) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Contribution to ArduinoJson | ||
|
||
First, thank you for taking the time to contribute to this project. | ||
|
||
You can submit changes via GitHub Pull Requests. | ||
|
||
Please: | ||
|
||
1. Update the test suite for any change of behavior | ||
2. Use clang-format in "file" mode to format the code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
The MIT License (MIT) | ||
--------------------- | ||
|
||
Copyright © 2014-2022, Benoit BLANCHON | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
![ArduinoJson](banner.svg) | ||
|
||
--- | ||
|
||
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/bblanchon/ArduinoJson/Continuous%20Integration?logo=github)](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A6.x) | ||
[![Continuous Integration](https://ci.appveyor.com/api/projects/status/m7s53wav1l0abssg/branch/6.x?svg=true)](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x) | ||
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/arduinojson.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson) | ||
[![LGTM Grade](https://img.shields.io/lgtm/grade/cpp/github/bblanchon/ArduinoJson?label=quality&logo=lgtm)](https://lgtm.com/projects/g/bblanchon/ArduinoJson/) | ||
[![Coveralls branch](https://img.shields.io/coveralls/github/bblanchon/ArduinoJson/6.x?logo=coveralls)](https://coveralls.io/github/bblanchon/ArduinoJson?branch=6.x) | ||
[![Arduino Library Manager](https://img.shields.io/static/v1?label=Arduino&message=v6.19.0&logo=arduino&logoColor=white&color=blue)](https://www.ardu-badge.com/ArduinoJson/6.19.0) | ||
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/bblanchon/library/ArduinoJson.svg?version=6.19.0)](https://registry.platformio.org/packages/libraries/bblanchon/ArduinoJson?version=6.19.0) | ||
[![GitHub stars](https://img.shields.io/github/stars/bblanchon/ArduinoJson?style=flat&logo=github)](https://github.com/bblanchon/ArduinoJson/stargazers) | ||
[![GitHub Sponsors](https://img.shields.io/github/sponsors/bblanchon?logo=github)](https://github.com/sponsors/bblanchon) | ||
|
||
ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things). | ||
|
||
## Features | ||
|
||
* [JSON deserialization](https://arduinojson.org/v6/api/json/deserializejson/?utm_source=github&utm_medium=readme) | ||
* [Optionally decodes UTF-16 escape sequences to UTF-8](https://arduinojson.org/v6/api/config/decode_unicode/?utm_source=github&utm_medium=readme) | ||
* [Optionally stores links to the input buffer (zero-copy)](https://arduinojson.org/v6/api/json/deserializejson/?utm_source=github&utm_medium=readme) | ||
* [Optionally supports comments in the input](https://arduinojson.org/v6/api/config/enable_comments/?utm_source=github&utm_medium=readme) | ||
* [Optionally filters the input to keep only desired values](https://arduinojson.org/v6/api/json/deserializejson/?utm_source=github&utm_medium=readme#filtering) | ||
* Supports single quotes as a string delimiter | ||
* Compatible with [NDJSON](http://ndjson.org/) and [JSON Lines](https://jsonlines.org/) | ||
* [JSON serialization](https://arduinojson.org/v6/api/json/serializejson/?utm_source=github&utm_medium=readme) | ||
* [Can write to a buffer or a stream](https://arduinojson.org/v6/api/json/serializejson/?utm_source=github&utm_medium=readme) | ||
* [Optionally indents the document (prettified JSON)](https://arduinojson.org/v6/api/json/serializejsonpretty/?utm_source=github&utm_medium=readme) | ||
* [MessagePack serialization](https://arduinojson.org/v6/api/msgpack/serializemsgpack/?utm_source=github&utm_medium=readme) | ||
* [MessagePack deserialization](https://arduinojson.org/v6/api/msgpack/deserializemsgpack/?utm_source=github&utm_medium=readme) | ||
* Efficient | ||
* [Twice smaller than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/?utm_source=github&utm_medium=readme) | ||
* [Almost 10% faster than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/?utm_source=github&utm_medium=readme) | ||
* [Consumes roughly 10% less RAM than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/?utm_source=github&utm_medium=readme) | ||
* [Fixed memory allocation, no heap fragmentation](https://arduinojson.org/v6/api/jsondocument/?utm_source=github&utm_medium=readme) | ||
* [Optionally works without heap memory (zero malloc)](https://arduinojson.org/v6/api/staticjsondocument/?utm_source=github&utm_medium=readme) | ||
* [Deduplicates strings](https://arduinojson.org/news/2020/08/01/version-6-16-0/?utm_source=github&utm_medium=readme) | ||
* Versatile | ||
* Supports [custom allocators (to use external RAM chip, for example)](https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/?utm_source=github&utm_medium=readme) | ||
* Supports [`String`](https://arduinojson.org/v6/api/config/enable_arduino_string/?utm_source=github&utm_medium=readme), [`std::string`](https://arduinojson.org/v6/api/config/enable_std_string/?utm_source=github&utm_medium=readme), and [`std::string_view`](https://arduinojson.org/v6/api/config/enable_string_view/?utm_source=github&utm_medium=readme) | ||
* Supports [`Stream`](https://arduinojson.org/v6/api/config/enable_arduino_stream/?utm_source=github&utm_medium=readme) and [`std::istream`/`std::ostream`](https://arduinojson.org/v6/api/config/enable_std_stream/?utm_source=github&utm_medium=readme) | ||
* Supports [Flash strings](https://arduinojson.org/v6/api/config/enable_progmem/?utm_source=github&utm_medium=readme) | ||
* Supports [custom readers](https://arduinojson.org/v6/api/json/deserializejson/?utm_source=github&utm_medium=readme#custom-reader) and [custom writers](https://arduinojson.org/v6/api/json/serializejson/?utm_source=github&utm_medium=readme#custom-writer) | ||
* Supports [custom converters](https://arduinojson.org/news/2021/05/04/version-6-18-0/?utm_source=github&utm_medium=readme) | ||
* Portable | ||
* Usable on any C++ project (not limited to Arduino) | ||
* Compatible with C++98, C++11, C++14 and C++17 | ||
* Zero warnings with `-Wall -Wextra -pedantic` and `/W4` | ||
* [Header-only library](https://en.wikipedia.org/wiki/Header-only) | ||
* Works with virtually any board | ||
* Arduino boards: [Uno](https://amzn.to/38aL2ik), [Due](https://amzn.to/36YkWi2), [Micro](https://amzn.to/35WkdwG), [Nano](https://amzn.to/2QTvwRX), [Mega](https://amzn.to/36XWhuf), [Yun](https://amzn.to/30odURc), [Leonardo](https://amzn.to/36XWjlR)... | ||
* Espressif chips: [ESP8266](https://amzn.to/36YluV8), [ESP32](https://amzn.to/2G4pRCB) | ||
* Lolin (WeMos) boards: [D1 mini](https://amzn.to/2QUpz7q), [D1 Mini Pro](https://amzn.to/36UsGSs)... | ||
* Teensy boards: [4.0](https://amzn.to/30ljXGq), [3.2](https://amzn.to/2FT0EuC), [2.0](https://amzn.to/2QXUMXj) | ||
* Particle boards: [Argon](https://amzn.to/2FQHa9X), [Boron](https://amzn.to/36WgLUd), [Electron](https://amzn.to/30vEc4k), [Photon](https://amzn.to/387F9Cd)... | ||
* Texas Instruments boards: [MSP430](https://amzn.to/30nJWgg)... | ||
* Soft cores: [Nios II](https://en.wikipedia.org/wiki/Nios_II)... | ||
* Tested on all major development environments | ||
* [Arduino IDE](https://www.arduino.cc/en/Main/Software) | ||
* [Atmel Studio](http://www.atmel.com/microsite/atmel-studio/) | ||
* [Atollic TrueSTUDIO](https://atollic.com/truestudio/) | ||
* [Energia](http://energia.nu/) | ||
* [IAR Embedded Workbench](https://www.iar.com/iar-embedded-workbench/) | ||
* [Keil uVision](http://www.keil.com/) | ||
* [MPLAB X IDE](http://www.microchip.com/mplab/mplab-x-ide) | ||
* [Particle](https://www.particle.io/) | ||
* [PlatformIO](http://platformio.org/) | ||
* [Sloeber plugin for Eclipse](https://eclipse.baeyens.it/) | ||
* [Visual Micro](http://www.visualmicro.com/) | ||
* [Visual Studio](https://www.visualstudio.com/) | ||
* [Even works with online compilers like wandbox.org](https://wandbox.org/permlink/RlZSKy17DjJ6HcdN) | ||
* [CMake friendly](https://arduinojson.org/v6/how-to/use-arduinojson-with-cmake/?utm_source=github&utm_medium=readme) | ||
* Well designed | ||
* [Elegant API](http://arduinojson.org/v6/example/?utm_source=github&utm_medium=readme) | ||
* [Thread-safe](https://en.wikipedia.org/wiki/Thread_safety) | ||
* Self-contained (no external dependency) | ||
* `const` friendly | ||
* [`for` friendly](https://arduinojson.org/v6/api/jsonobject/begin_end/?utm_source=github&utm_medium=readme) | ||
* [TMP friendly](https://en.wikipedia.org/wiki/Template_metaprogramming) | ||
* Handles [integer overflows](https://arduinojson.org/v6/api/jsonvariant/as/?utm_source=github&utm_medium=readme#integer-overflows) | ||
* Well tested | ||
* [Unit test coverage close to 100%](https://coveralls.io/github/bblanchon/ArduinoJson?branch=6.x) | ||
* Continuously tested on | ||
* [Visual Studio 2010, 2012, 2013, 2015, 2017, 2019, 2022](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x) | ||
* [GCC 4.4, 4.6, 4.7, 4.8, 4.9, 5, 6, 7, 8, 9, 10, 11](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22) | ||
* [Clang 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 5.0, 6.0, 7, 8, 9, 10](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22) | ||
* [Continuously fuzzed with Google OSS Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson) | ||
* Passes all default checks of [clang-tidy](https://releases.llvm.org/10.0.0/tools/clang/tools/extra/docs/clang-tidy/) | ||
* Well documented | ||
* [Tutorials](https://arduinojson.org/v6/doc/deserialization/?utm_source=github&utm_medium=readme) | ||
* [Examples](https://arduinojson.org/v6/example/?utm_source=github&utm_medium=readme) | ||
* [How-tos](https://arduinojson.org/v6/example/?utm_source=github&utm_medium=readme) | ||
* [FAQ](https://arduinojson.org/v6/faq/?utm_source=github&utm_medium=readme) | ||
* [Troubleshooter](https://arduinojson.org/v6/troubleshooter/?utm_source=github&utm_medium=readme) | ||
* [Book](https://arduinojson.org/book/?utm_source=github&utm_medium=readme) | ||
* [Changelog](CHANGELOG.md) | ||
* Vibrant user community | ||
* Most popular of all Arduino libraries on [GitHub](https://github.com/search?o=desc&q=arduino+library&s=stars&type=Repositories) | ||
* [Used in hundreds of projects](https://www.hackster.io/search?i=projects&q=arduinojson) | ||
* [Responsive support](https://github.com/bblanchon/ArduinoJson/issues?q=is%3Aissue+is%3Aclosed) | ||
* [Discord server](https://discord.gg/DzN6hHHD4h) | ||
|
||
## Quickstart | ||
|
||
### Deserialization | ||
|
||
Here is a program that parses a JSON document with ArduinoJson. | ||
|
||
```c++ | ||
char json[] = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; | ||
|
||
DynamicJsonDocument doc(1024); | ||
deserializeJson(doc, json); | ||
|
||
const char* sensor = doc["sensor"]; | ||
long time = doc["time"]; | ||
double latitude = doc["data"][0]; | ||
double longitude = doc["data"][1]; | ||
``` | ||
See the [tutorial on arduinojson.org](https://arduinojson.org/doc/decoding/?utm_source=github&utm_medium=readme) | ||
### Serialization | ||
Here is a program that generates a JSON document with ArduinoJson: | ||
```c++ | ||
DynamicJsonDocument doc(1024); | ||
doc["sensor"] = "gps"; | ||
doc["time"] = 1351824120; | ||
doc["data"][0] = 48.756080; | ||
doc["data"][1] = 2.302038; | ||
serializeJson(doc, Serial); | ||
// This prints: | ||
// {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} | ||
``` | ||
|
||
See the [tutorial on arduinojson.org](https://arduinojson.org/doc/encoding/?utm_source=github&utm_medium=readme) | ||
|
||
## Sponsors | ||
|
||
ArduinoJson is thankful to its sponsors. Please give them a visit; they deserve it! | ||
|
||
<p> | ||
<a href="https://techexplorations.com/" rel="sponsored"> | ||
<img alt="Tech Explorations" src="https://arduinojson.org/images/2021/10/techexplorations.png" width="200"> | ||
</a> | ||
<a href="https://www.programmingelectronics.com/" rel="sponsored"> | ||
<img src="https://arduinojson.org/images/2021/10/programmingeleactronicsacademy.png" alt="Programming Electronics Academy" width="200"> | ||
</a> | ||
</p> | ||
<p> | ||
<a href="https://github.com/1technophile" rel="sponsored"> | ||
<img alt="1technophile" src="https://avatars.githubusercontent.com/u/12672732?s=40&v=4"> | ||
</a> | ||
</p> | ||
|
||
If you run a commercial project that embeds ArduinoJson, think about [sponsoring the library's development](https://github.com/sponsors/bblanchon): it ensures the code that your products rely on stays actively maintained. It can also give your project some exposure to the makers' community. | ||
|
||
If you are an individual user and want to support the development (or give a sign of appreciation), consider purchasing the book [Mastering ArduinoJson](https://arduinojson.org/book/) ❤, or simply [cast a star](https://github.com/bblanchon/ArduinoJson/stargazers) ⭐. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# ArduinoJson Support | ||
|
||
First off, thank you very much for using ArduinoJson. | ||
|
||
We'll be very happy to help you, but first please read the following. | ||
|
||
## Before asking for help | ||
|
||
1. Read the [FAQ](https://arduinojson.org/faq/?utm_source=github&utm_medium=support) | ||
2. Search in the [API Reference](https://arduinojson.org/api/?utm_source=github&utm_medium=support) | ||
|
||
If you did not find the answer, please create a [new issue on GitHub](https://github.com/bblanchon/ArduinoJson/issues/new). | ||
|
||
It is OK to add a comment to a currently opened issue, but please avoid adding comments to a closed issue. | ||
|
||
## Before hitting the Submit button | ||
|
||
Please provide all the relevant information: | ||
|
||
* Good title | ||
* Short description of the problem | ||
* Target platform | ||
* Compiler model and version | ||
* [MVCE](https://stackoverflow.com/help/mcve) | ||
* Compiler output | ||
|
||
Good questions get fast answers! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
version: 6.19.0.{build} | ||
environment: | ||
matrix: | ||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 | ||
CMAKE_GENERATOR: Visual Studio 17 2022 | ||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 | ||
CMAKE_GENERATOR: Visual Studio 16 2019 | ||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 | ||
CMAKE_GENERATOR: Visual Studio 15 2017 | ||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
CMAKE_GENERATOR: Visual Studio 14 2015 | ||
- CMAKE_GENERATOR: Visual Studio 12 2013 | ||
- CMAKE_GENERATOR: Visual Studio 11 2012 | ||
- CMAKE_GENERATOR: Visual Studio 10 2010 | ||
- CMAKE_GENERATOR: Ninja | ||
MINGW: MinGW # MinGW 32-bit 5.3.0 | ||
- CMAKE_GENERATOR: Ninja | ||
MINGW32: i686-5.3.0-posix-dwarf-rt_v4-rev0 # MinGW-w64 5.3.0 | ||
- CMAKE_GENERATOR: Ninja | ||
MINGW32: i686-6.3.0-posix-dwarf-rt_v5-rev1 # MinGW-w64 6.3.0 i686 | ||
- CMAKE_GENERATOR: Ninja | ||
MINGW64: x86_64-6.3.0-posix-seh-rt_v5-rev1 # MinGW-w64 6.3.0 x86_64 | ||
- CMAKE_GENERATOR: Ninja | ||
MINGW64: x86_64-7.3.0-posix-seh-rt_v5-rev0 # MinGW-w64 7.3.0 x86_64 | ||
- CMAKE_GENERATOR: Ninja | ||
MINGW64: x86_64-8.1.0-posix-seh-rt_v6-rev0 # MinGW-w64 8.1.0 x86_64 | ||
configuration: Debug | ||
before_build: | ||
- set PATH=%PATH:C:\Program Files\Git\usr\bin;=% # Workaround for CMake not wanting sh.exe on PATH for MinGW | ||
- if defined MINGW set PATH=C:\%MINGW%\bin;%PATH% | ||
- if defined MINGW32 set PATH=C:\mingw-w64\%MINGW32%\mingw32\bin;%PATH% | ||
- if defined MINGW64 set PATH=C:\mingw-w64\%MINGW64%\mingw64\bin;%PATH% | ||
- cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%CMAKE_GENERATOR%" . | ||
build_script: | ||
- cmake --build . --config %CONFIGURATION% | ||
test_script: | ||
- ctest -C %CONFIGURATION% --output-on-failure . |
Oops, something went wrong.