Original:
Rapidjson--c++ Fast JSON Parser and generator time 2015-04-05 07:33:33 Open source China News original Http://www.oschina.net/p/rapidjson
April 18 Wuhan Source Chong will start registration, send Development Board
Rapidjson is a C + + fast JSON parser and generator that uses the Sax/dom style API design.
Example code:
Rapidjson/example/simpledom/simpledom.cpp '#include "Rapidjson/document.h"#include "Rapidjson/writer.h"#include "Rapidjson/stringbuffer.h"#include <iostream>Usingnamespace Rapidjson;int main () { 1. Parse a JSON string into DOM. Constchar* JSON ="{\" project\ ": \" rapidjson\ ", \" Stars\ ": 10}"; Document D; D.parse (JSON); //2. Modify it by Dom. value& s = D[ "stars"]; S.setint (s . GetInt () + 1); //3. Stringify the Dom StringBuffer buffer; writer<stringbuffer> writer (buffer); D.accept (writer); //Output {"Project": "Rapidjson", "Stars": 11} Span class= "built_in" >std::cout << buffer. GetString () << std::endl; return 0;}
Introduction PPT Download: http://www.oschina.net/doc/5711
Main Features:
-
-
Small, full-featured, sax and DOM-style APIs, only a SAX parser with only hundred lines of code
-
-
Fast
-
-
No reliance on other third-party libraries
-
-
Compact. Each JSON value is a bytes for a or 64-bit machines respectively (excluding text string storage). With the custom memory allocator, parser allocates memory compactly during parsing.
-
-
Fully compatible with RFC4627, support UTF-8, UTF-16 and UTF-32.
-
-
Support both In-situ parsing (directly decode strings into the source JSON text) and non-destructive parsing (decode Strin GS into new buffers).
-
-
Parse number to int/unsigned/int64_t/uint64_t/double depending on input
-
-
Supports custom memory allocations. Also, the default memory pool allocator can Also is supplied with a user buffer (such as a buffer allocated on user ' s heap or programme stack) to minimize allocation.
This thing, write C + + plug-in can be used. Rapidjson--c++ Fast JSON Parser and generator