How to create empty array
nirenrc opened this issue · comments
nirenrc commented
Hello
I would like to create empty array, could not find working syntax using "Set" API. e,g. to achieve below json
{
"home": {
"kitchen": {
"refrigerator": []
}
}
}
what would be path syntax in Set API or any other to achieve same?
Niren
Josh Baker commented
Hi, try the SetRaw
function.
sjson.SetRaw(json, "home.kitchen.refridgerator", "[]")
nirenrc commented
Thank You
Yes, it works. Other option of "-1" works too
sjson.SetRaw(json, "home.kitchen.refridgerator.-1", "")
Niren