nesting level
can I somehow control the level of nesting? How is it easiest for me to implement? nesting (int 0-5, default 3)
Hi, I don't understand what you mean by nesting level, can you please elaborate?
Is this about the width of indentation?
Hi, nope, I mean that there is a parameter that minimizes all the nodes (collapsed), but there is no parameter that indicates what level of nesting should be minimized by default (nestingLvl)
{collapsed: false, withQuotes: false, withLinks: false, nestingLvl: 3}
1lvl - { id: 1001, type: "donut", name: "Cake", 2lvl - available: { store: 42, warehouse: 600 }, toppings: [ 3lvl - {2 items}, # collapsed by nestingLvl param ], }
OK I understand what you want to achieve! This could be useful, but I don't know if I'll have time for this.
If you want to give it a shot and implement this option, you would need to add a depth argument to the recursive json2html function, which should be incremented before each recursive call:
function json2html(json, depth, options) {
// ...
json2html(json, depth + 1, options)
}
And set the collapsed CSS class on a elements according to the nesting level option value.
Hope this helps.