JSON library for parser and serializer picojson is a header-file-only, JSON parser serializer in C++. The original source code is available at https://github.com/kazuho/picojson You can parse a JSON string using something like <<code>> picojson::value v; const char *json = "{\"string\": \"it works\", \"number\": 3.14}"; string err = picojson::parse(v, json, json + strlen(json)); printf("--> res %s\r\n", err.c_str()); printf("string =%s\r\n" , v.get("string").get<string>()); printf("number =%f\r\n" , v.get("number").get<double>()); <</code>> or serialize using something like <<code>> picojson::object v; v["aa"] = picojson::value(string("tt")); v["bb"] = picojson::value(double(1)); string str = picojson::value(v).serialize(); printf("result =%s\r\n" , str.c_str()); <</code>> Note: it seems that there are some memory? issues with "complex" structures. So always test your json with the lib before using it within your application.
Dependents: PicoJSONSample SenseClientSample net-o-meter AV_MQTT ... more
All pull requests
No pull requests found.