How to get the linenumbers which have a foldgutter

I am creating a IDE for json with codemirror6, in which I need to calculate the children till n’th level. I’ve wrote the program to get the code in codemirror and a function to calculate the children upto last level. While reading the documentation, I get to know ‘foldable’ is the one which checks the line is foldable or not. But not sure on how to use foldable and also is the correct way of doing this! Can someone help me in getting the lines which has a foldgutter in it?

Thanks in advance

That is not information that the fold gutter extension exposes. But from your problem description, it sounds like what you need is to run your own program over the syntax tree of the JSON, which will give you the document’s structure.