<p>updated and added printing functions for lists and trees to output fully formatted JSON-style nested objects</p>

<p>to test: write test program, build a complex nested object using lists and objects and various basic types, and print it using <code>co_list_print()</code> or <code>co_tree_print()</code>!</p>

<p>Here's code for a sample object:</p>

<pre><code>CHECK_MEM((params = co_tree16_create()));
CHECK(co_tree_insert(params,"testint",sizeof("testint"),co_int8_create(-123,0)),"Failed to insert testint into request tree");
co_tree_insert(params,"testuint",sizeof("testuint"),co_uint8_create(123,0));
co_tree_insert(params,"testfloat",sizeof("testfloat"),co_float32_create(123.567,0));
co_obj_t *tree2 = co_tree16_create();
co_obj_t *tree3 = co_tree16_create();
co_tree_insert(tree3,"subtree2",sizeof("subtree2"),co_str8_create("subtree",sizeof("subtree"),0));
co_tree_insert(tree3,"blah",sizeof("blah"),co_str8_create("blah",sizeof("blah"),0));
co_tree_insert(tree2,"subtree",sizeof("subtree"),tree3);
co_tree_insert(tree2,"foo",sizeof("foo"),co_str8_create("foo",sizeof("foo"),0));
co_obj_t *list = co_list16_create();
co_list_append(list,co_str8_create("bar",sizeof("bar"),0));
co_tree_insert(tree2,"bar",sizeof("bar"),list);
co_obj_t *tree4 = co_tree16_create();
co_tree_insert(tree4,"baz",sizeof("baz"),co_str8_create("baz",sizeof("baz"),0));
co_list_append(list,tree4);
co_obj_t *list2 = co_list16_create();
co_list_append(list2,co_str8_create("egg",sizeof("egg"),0));
co_list_append(list,list2);
CHECK(co_tree_insert(params,"test3",sizeof("test3"),tree2),"Failed to insert tree2 into request tree");
co_tree_print(params);
</code></pre>

<p>And here's what it should print out:</p>

<pre><code>  {
    "test3": 
      {
        "bar": 
          [
            "bar",
            {
              "baz": "baz"
            },
            [
              "egg"
            ]
          ],
        "foo": "foo",
        "subtree": 
          {
            "blah": "blah",
            "subtree2": "subtree"
          }
      },
    "testfloat": 123.567001,
    "testint": -123,
    "testuint": 123
  }
</code></pre>

<hr>

<h4>You can merge this Pull Request by running</h4>
<pre>  git pull https://github.com/opentechinstitute/commotiond print-json</pre>
<p>Or view, comment on, or merge it at:</p>
<p>  <a href='https://github.com/opentechinstitute/commotiond/pull/89'>https://github.com/opentechinstitute/commotiond/pull/89</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>updated and added printing functions for lists and trees to output fully formatted JSON-style nested objects</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/opentechinstitute/commotiond/pull/89/files#diff-0">src/list.c</a>
    (91)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/opentechinstitute/commotiond/pull/89/files#diff-1">src/list.h</a>
    (14)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/opentechinstitute/commotiond/pull/89/files#diff-2">src/tree.c</a>
    (91)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/opentechinstitute/commotiond/pull/89/files#diff-3">src/tree.h</a>
    (7)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/opentechinstitute/commotiond/pull/89.patch'>https://github.com/opentechinstitute/commotiond/pull/89.patch</a></li>
  <li><a href='https://github.com/opentechinstitute/commotiond/pull/89.diff'>https://github.com/opentechinstitute/commotiond/pull/89.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href='https://github.com/opentechinstitute/commotiond/pull/89'>view it on GitHub</a>.<img src='https://github.com/notifications/beacon/3074564__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcwNzM1Nzg1OCwiZGF0YSI6eyJpZCI6MjUyMzY2NjF9fQ==--cddbb3f4617caf7c202f2713f892be05a162e964.gif' height='1' width='1'></p>