util: json: Properly implement JSON deflattening

As it turns out sometimes users pass in an arbitrarily nested structure
e.g. for the qemu backing chains JSON pseudo protocol. This new
implementation deflattens now a single object fully even with nested
keys.

Additionally it's not necessary now to stick with the "file." prefix for
the properties.
This commit is contained in:
Peter Krempa
2017-07-11 14:13:35 +02:00
parent 7f1209ad1e
commit d40f4b3e67
8 changed files with 121 additions and 47 deletions
+4 -4
View File
@@ -512,13 +512,13 @@ mymain(void)
DO_TEST_DEFLATTEN("unflattened", true);
DO_TEST_DEFLATTEN("basic-file", true);
DO_TEST_DEFLATTEN("basic-generic", false);
DO_TEST_DEFLATTEN("basic-generic", true);
DO_TEST_DEFLATTEN("deep-file", true);
DO_TEST_DEFLATTEN("deep-generic", false);
DO_TEST_DEFLATTEN("deep-generic", true);
DO_TEST_DEFLATTEN("nested", true);
DO_TEST_DEFLATTEN("double-key", true);
DO_TEST_DEFLATTEN("double-key", false);
DO_TEST_DEFLATTEN("concat", true);
DO_TEST_DEFLATTEN("concat-double-key", true);
DO_TEST_DEFLATTEN("concat-double-key", false);
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}