static String getPath(int stackSize, int[] stack, String[] pathNames, int[] pathIndices) {
    StringBuilder result = new StringBuilder().append('$');
    for (int i = 0; i < stackSize; i++) {
      switch (stack[i]) {
        case EMPTY_ARRAY:
        case NONEMPTY_ARRAY:
          result.append('[').append(pathIndices[i]).append(']');
          break;

        case EMPTY_OBJECT:
        case DANGLING_NAME:
        case NONEMPTY_OBJECT:
          result.append('.');
          if (pathNames[i] != null) {
            result.append(pathNames[i]);
          }
          break;

        case NONEMPTY_DOCUMENT:
        case EMPTY_DOCUMENT:
        case CLOSED:
          break;
      }
    }
    return result.toString();
  }
Renders the path in a JSON document to a string. The {@code pathNames} and {@code pathIndices}
parameters corresponds directly to stack: At indices where the stack contains an object
(EMPTY_OBJECT, DANGLING_NAME or NONEMPTY_OBJECT), pathNames contains the name at this scope.
Where it contains an array (EMPTY_ARRAY, NONEMPTY_ARRAY) pathIndices contains the current index
in that array. Otherwise the value is undefined, and we take advantage of that by incrementing
pathIndices when doing so isn't useful.
lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonScope.java