I have a JSON string similar to this one:
{
"Version": "XXX",
"Statements": [
{...},
{...},
{...}
]
}
How can I find out which object inside Statements property is defined at character XX
of the JSON string? (considering that those objects can have arbitrarily deep nesting).
For example, if I have a string
{"Version":"XXX","Statements":[{"a":1},{"b":2},{"b":3}]}
--------------------------------------------------------
123456789 123456789 123456789 123456789 123456789 123456
then character at position 36
would correspond to the first statement object, while character at position 52
would correspond to the third statement object.
X
could be, or how a character relates to positions of objects.indexOf
? Or am I oversimplifying the problem..