Transform error path like <property>.<property> to smth codemirror can understand

I have some kind of a validation. The problem is that it gives back the error path like

<property>/<anotherProperty>

While in codemirror, what i needed is from and to. Is there any utility in codemirror, that would allow to map properties path like this, to from and to ? The closest I could get is using json string and a bunch of regex, but it is not the most reliable option.

Is this in a JSON document? You might be able to use the syntax tree to find the range corresponding to a given path, but it’d require some programming.

Hello. Yes, it is a json editor.
With syntaxTree do you mean smth like

syntaxTree(view.state)

Maybe I was using it in a wrong way, but it gave me a single node back and that node was the entire document.

I also tried to get the starting position of the property and then do

iterLines

but it is not very reliable in a sense that if you have smth like

{
  "property": [
    { "nestedProp": "nestedValue"}
  ]
}

It can be also like

{
  "property": [{ 
    "nestedProp": "nestedValue"
  }]
}

So if you go line by line you could have a lot of different variations of how the same object is being written, so relying on the fact that string which has { would not be reliable.