ttsuki / Nanojson
Licence: mit
Single C++ header file only json reader/writer
Labels
Projects that are alternatives of or similar to Nanojson
Portabletext
Portable Text is a JSON based rich text specification for modern content editing platforms.
Stars: ✭ 759 (+12550%)
Mutual labels: json
Ky
🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API
Stars: ✭ 7,047 (+117350%)
Mutual labels: json
Himotoki
A type-safe JSON decoding library purely written in Swift
Stars: ✭ 786 (+13000%)
Mutual labels: json
Factbook.json
World Factbook Country Profiles in JSON - Free Open Public Domain Data - No API Key Required ;-)
Stars: ✭ 750 (+12400%)
Mutual labels: json
Jsonlite
A simple, self-contained, serverless, zero-configuration, json document store.
Stars: ✭ 819 (+13550%)
Mutual labels: json
Ason
[DEPRECATED]: Prefer Moshi, Jackson, Gson, or LoganSquare
Stars: ✭ 777 (+12850%)
Mutual labels: json
Winterfell
Generate complex, validated and extendable JSON-based forms in React.
Stars: ✭ 787 (+13016.67%)
Mutual labels: json
Dasel
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.
Stars: ✭ 759 (+12550%)
Mutual labels: json
Yaml.js
Standalone JavaScript YAML 1.2 Parser & Encoder. Works under node.js and all major browsers. Also brings command line YAML/JSON conversion tools.
Stars: ✭ 810 (+13400%)
Mutual labels: json
Quicktype
Generate types and converters from JSON, Schema, and GraphQL
Stars: ✭ 7,459 (+124216.67%)
Mutual labels: json
Rss Parser
A lightweight RSS parser, for Node and the browser
Stars: ✭ 793 (+13116.67%)
Mutual labels: json
nanojson - Simple json reader/writer
🌟 Single C++ header only.
🔴 Caution! this library allows:
- last comma of array: [1,2,3,]
- last comma of object: { "a":1, "b":2, }
- non-quoated object-key: { a:1, b:2 }
- block/line comment: [ /* value of hoge */ 1, ] // <- array of fuga
- for the purpose of parsing json-like configuration file with help comment.
License
MIT
Sample Code
#include "nanojson.h"
#include <iostream>
int main()
{
#define LF "\n"
std::stringstream ss = std::stringstream(std::string(
"[123, {" LF
"a : \"あいう\\\\n\\tえお\", " LF
" \t b : true, " LF
" c : null, " LF
" /* start comment ..." LF
" x : here is in block comment" LF
" ... end comment */" LF
"\"d\\u0001\" : false, " LF
" // e is a test integer." LF
" // f is a test floating." LF
"e : 1234567890123456789, " LF
"f : -123.4567e+89, " LF
"} ]"));
std::cout << "input json: " << std::endl;
std::cout << ss.str() << std::endl;
std::cout << "parsed json:" << std::endl;
nanojson::element e = nanojson::element::from_string(ss.str());
std::cout << e.to_json_string() << std::endl;
std::cout << "values:" << std::endl;
if (e[1]["a"].is_defined()) { std::cout << "e[1][\"a\"] = " << e[1]["a"].to_string() << std::endl; }
if (e[1]["f"].is_defined()) { std::cout << "e[1][\"f\"] = " << e[1]["f"].to_string() << std::endl; }
if (e[1]["x"].is_defined()) { std::cout << "e[1][\"x\"] = " << e[1]["x"].to_string() << std::endl; }
std::cout << "input test json:" << std::endl;
try {
std::cin >> e;
}
catch (nanojson::nanojson_exception &)
{
std::cout << "il-formed json data." << std::endl;
e = nanojson::element::undefined();
}
std::cout << "parsed json:" << std::endl;
std::cout << e << std::endl;
return 0;
}
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].