This is the documentation for the latest (main) development branch. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

cJSON Demo

Overview

After starting this application, perform the following actions:

  1. Create cJSON root node

  2. Add strings, numbers, and other content to the root node

  3. Create a leaf node, add strings, numbers, and other content to the leaf node, and then add the leaf node to the root node after completion

  4. Create leaf nodes, add arrays to leaf nodes, and add leaf nodes to the root node after completion

  5. Add True, NULL and other objects to the root node

  6. Convert the root node into a string and print it

  7. Release the root node

Building and flashing

Example Location: examples/storage/cjson

compile, burn, and more, see: get started

Running result

Successfully running will output the following logs

I/cjson_example   [0.004] start cJSON demo...
{
        "Name": "Jack",
        "Age":  28,
        "Weight":       68,
        "Information":  {
                "Company":      "WinnerMicro",
                "Department":   "SoftwareDepartment",
                "Number":       8
        },
        "Score":        [18, 20, 23, 25],
        "IsMan":        true,
        "Other":        null
}