问题
I have a collection of strings in an array. These strings are the JSON paths that i select from a checkbox tree.
var selected = ['a', 'b.c.0.d', 'b.c.1.d', 'b.c.0.e', 'b.c.1.e'];
I want to save it to the database with the real data given by the user. So i want to create a JSON object like following structure. It can be further nested.
{ "a":5, "b":{ "c":[ { "d":5, "e":5 }, { "d":5, "e":5 } ] } }
来源:https://stackoverflow.com/questions/59882169/how-to-build-a-json-object-using-collection-of-dot-notation-strings-using-javasc