unfold
unfold
function converts a key-value pair object into JSON object by unfolding it.
Arguments
-
object
type:
object
The key-value pair object to unfold.
e.g.
{ "a.b": "c" }
will be unfolded to{ a: { b: "c" } }
. -
option
type:
object
-
arrayIndex
type:
"dot" | "bracket"
default:
"bracket"
The index of array to unfold.
e.g.
{ "a[0]": "b" }
will be unfolded to{ a: ["b"] }
ifarrayIndex
is"bracket"
, and will be unfolded to{ a: { 0: "b" } }
ifarrayIndex
is"dot"
. -
pruneArray
type:
boolean
default:
true
Whether to prune the array when unfolding.
e.g.
{ "a[1]": "b" }
will be unfolded to{ a: [undefined, "b"] }
ifpruneArray
isfalse
, and will be unfolded to{ a: ["b"] }
ifpruneArray
istrue
.
-