wlib-json

1.0.6 • Public • Published

wlib-json

JSON Library for WLib. Parse and stringify implemented without recursion, and supports type conversions.

Install

wio install wlib-json

Usage

using namespace wlp;
 
constexpr auto json_str = "{\"mem_size\":64,\"region_name\":\"devmem1\"}";
json_element element = json::parse(json_str);
if (element.is_object()) {
    printf("region_name: %s\n", element["region_name"].as<char *>());
    printf("mem_size:    %i\n", element["mem_size"].as<int>());
    
    json_array flags = {0x200x320x50};
    element.object().insert("flags", move(flags));
    
    static char buf[128];
    json::stringify(buf, element);
}

Package Sidebar

Install

npm i wlib-json

Weekly Downloads

2

Version

1.0.6

License

none

Unpacked Size

152 kB

Total Files

50

Last publish

Collaborators

  • mogball
  • wio-admin