parseIndex function
Parses an index from a JSON path expression.
Implementation
int parseIndex(String jsonPath, int index) {
final buffer = StringBuffer();
while (index < jsonPath.length && isDigit(jsonPath[index])) {
buffer.write(jsonPath[index]);
index++;
}
return int.parse(buffer.toString());
}