A light-weight json parser.

pson

pson is a lightweight parser and it support six type, null , bool, number, string, array, object, and it can parse the encoding of UTF-8.

It's fast, small and it's simple to use.

You just need to #include "pson.hpp" to your projects~

usage

    using namespace pson;
    std::string json = "{\n"
                       "  \"pink\" : {\n"
                       "    \"ktouch\" : \"phone\",\n"
                       "    \"xiaomi\" : \"phone\"\n"
                       "  },\n"
                       "  \"computer\" : [\"惠普\", 100.0, false, true],\n"
                       "  \"age\" : 20,\n"
                       "  \"best code\" : \"non\",\n"
                       "  \"man\" : true\n"
                       "}";

    Value v;
    v.parse(json);
    
    assert(v.is<Object>() == true);
    assert(v["computer"][0].as<String>() == "惠普");
    assert(v["pink"]["ktouch"].as_string() == "phone");
    assert(v["computer"][1].as_number() == 100.0);
    assert(v["man"].as<Bool>() == true);

    Value cp_v(v);  // Copy
    Value mv_c(std::move(v)); // Move
    
    // Use array, or object to move and copy
    Value a(JSON_ARRAY), o(JSON_OBJECT);
    a.push_back(std::move(v));     // Move
    o.insert("This is copy", v);   // Copy
    
    // To string
    std::string tostr = a.print();

hf!

TODO

fix v1

Owner
pinK
Fan of Igor(author of nginx), and Steven(author of Advanced Programming in the UNIX Environment)
pinK
Similar Resources

a header-file-only, JSON parser serializer in C++

PicoJSON - a C++ JSON parser / serializer Copyright © 2009-2010 Cybozu Labs, Inc. Copyright © 2011-2015 Kazuho Oku Licensed under 2-clause BSD license

Dec 27, 2022

A fast JSON parser/generator for C++ with both SAX/DOM style API

A fast JSON parser/generator for C++ with both SAX/DOM style API

A fast JSON parser/generator for C++ with both SAX/DOM style API Tencent is pleased to support the open source community by making RapidJSON available

Dec 30, 2022

Lightweight, extremely high-performance JSON parser for C++11

sajson sajson is an extremely high-performance, in-place, DOM-style JSON parser written in C++. Originally, sajson meant Single Allocation JSON, but i

Dec 16, 2022

🔋 In-place lightweight JSON parser

🔋 JSON parser for C This is very simple and very powerful JSON parser. It creates DOM-like data structure and allows to iterate and process JSON obje

Dec 10, 2022

RapidJSON is a JSON parser and generator for C++.

RapidJSON is a JSON parser and generator for C++.

A fast JSON parser/generator for C++ with both SAX/DOM style API

Dec 30, 2022

single-header json parser for c99 and c++

ghh_json.h a single-header ISO-C99 (and C++ compatible) json loader. why? obviously this isn't the first json library written for C, so why would I wr

Dec 1, 2022

Buggy JSON parser

Fuzzgoat: A minimal libFuzzer integration This repository contains a basic C project that includes an (intentionally insecure) JSON parser. It is an e

Apr 11, 2022

A generator of JSON parser & serializer C++ code from structure header files

JSON-CPP-gen This is a program that parses C++ structures from a header file and automatically generates C++ code capable of serializing said structur

Oct 13, 2022

Very low footprint JSON parser written in portable ANSI C

Very low footprint JSON parser written in portable C89 (sometimes referred to as ANSI C). BSD licensed with no dependencies (i.e. just drop the C file

Dec 23, 2022
Related tags
A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON

JSONCONS jsoncons is a C++, header-only library for constructing JSON and JSON-like data formats such as CBOR. For each supported data format, it enab

Jan 4, 2023
Ultralightweight JSON parser in ANSI C

cJSON Ultralightweight JSON parser in ANSI C. Table of contents License Usage Welcome to cJSON Building Copying the source CMake Makefile Vcpkg Includ

Jan 4, 2023
JSON parser and generator for C/C++ with scanf/printf like interface. Targeting embedded systems.

JSON parser and emitter for C/C++ Features ISO C and ISO C++ compliant portable code Very small footprint No dependencies json_scanf() scans a string

Dec 30, 2022
JSON & BSON parser/writer

jbson is a library for building & iterating BSON data, and JSON documents in C++14. \tableofcontents Features # {#features} Header only. Boost license

Sep 14, 2022
Jsmn is a world fastest JSON parser/tokenizer. This is the official repo replacing the old one at Bitbucket

JSMN jsmn (pronounced like 'jasmine') is a minimalistic JSON parser in C. It can be easily integrated into resource-limited or embedded projects. You

Jan 9, 2023
A JSON parser in C++

JSON++ Introduction JSON++ is a light-weight JSON parser, writer and reader written in C++. JSON++ can also convert JSON documents into lossless XML d

Dec 28, 2022
🗄️ single header json parser for C and C++

??️ json.h A simple single header solution to parsing JSON in C and C++. JSON is parsed into a read-only, single allocation buffer. The current suppor

Jan 7, 2023
Very low footprint JSON parser written in portable ANSI C

Very low footprint JSON parser written in portable ANSI C. BSD licensed with no dependencies (i.e. just drop the C file into your project) Never recur

Jan 5, 2023
Very simple C++ JSON Parser

Very simple JSON parser for c++ data.json: { "examples": [ { "tag_name": "a", "attr": [ { "key":

Nov 20, 2022
a JSON parser and printer library in C. easy to integrate with any model.

libjson - simple and efficient json parser and printer in C Introduction libjson is a simple library without any dependancies to parse and pretty prin

Nov 21, 2022