You can use the getPositionAt(index) function to find the line number by path.
This is how you can achieve it in js
const path = ['pages', 0, 'text']; // Your desired path
const index = model.getValue().indexOf(JSON.stringify(path));
const position = model.getPositionAt(index);
console.log(`Line number for path ${JSON.stringify(path)}: ${position.lineNumber}`);
You can use the
getPositionAt(index)function to find the line number by path.This is how you can achieve it in js