Get a flatten object
auto obj = Json.emptyObject; obj["key1"] = 1; obj["key2"] = 2; obj["key3"] = Json.emptyObject; obj["key3"]["item1"] = "3"; obj["key3"]["item2"] = Json.emptyObject; obj["key3"]["item2"]["item4"] = Json.emptyObject; obj["key3"]["item2"]["item5"] = Json.emptyObject; obj["key3"]["item2"]["item5"]["item6"] = Json.emptyObject; auto result = obj.flatten; result.byKeyValue.map!(a => a.key).should.containOnly(["key1", "key2", "key3.item1", "key3.item2.item4", "key3.item2.item5.item6"]); result["key1"].should.equal(1); result["key2"].should.equal(2); result["key3.item1"].should.equal("3"); result["key3.item2.item4"].should.equal(Json.emptyObject); result["key3.item2.item5.item6"].should.equal(Json.emptyObject);
Takes a nested Json object and moves the values to a Json assoc array where the key is the path from the original object to that value