private PdxListHelper getList(JsonParser jp, states currentState, PdxListHelper currentPdxList)
      throws IOException {
    String currentFieldName = null;
    currentPdxList = new PdxListHelper(currentPdxList, null);
    while (true) {
      JsonToken nt = jp.nextToken();

      if (nt == null) {
        return currentPdxList;
      }
      switch (nt) {
        case START_OBJECT: {
          objectStarts(currentState);
          currentState = states.OBJECT_START;
          // need to create new PdxInstance
          // root object will not name, so create classname lazily from all members.
          // child object will have name; but create this as well lazily from all members
          JSONToPdxMapper tmp = getPdxInstance(jp, currentState, null);
          currentPdxList.addObjectField(currentFieldName, tmp);
          currentState = states.OBJECT_ENDS;
          break;
        }
        case END_OBJECT: {
          // pdxinstnce ends
          throw new IllegalStateException(
              "getList got token END_OBJECT while current state is " + currentState);
        }
        case FIELD_NAME: {
          throw new IllegalStateException(
              "getList got token FIELD_NAME while current state is " + currentState);
        }
        case NOT_AVAILABLE: {
          throw new IllegalStateException(
              "NOT_AVAILABLE token found in getList current state is " + currentState);
          // break;
        }
        case START_ARRAY: {
          // need to create array; fieldname may be there; will it case it not there
          arrayStarts(currentState);
          PdxListHelper tmp = currentPdxList.addListField();
          currentPdxList = tmp;
          currentState = states.LIST_FOUND;
          break;
        }
        case END_ARRAY: {
          // array is end
          arrayEnds(currentState);
          currentState = states.LIST_ENDS;
          if (currentPdxList.getParent() == null) {
            return currentPdxList;
          }
          currentPdxList = currentPdxList.getParent();
          break;
        }
        case VALUE_EMBEDDED_OBJECT: {
          throw new IllegalStateException("VALUE_EMBEDDED_OBJECT token found");
        }
        case VALUE_FALSE: {
          // write boolen
          boolFound(currentState);
          currentState = states.SCALAR_FOUND;
          currentPdxList.addBooleanField(jp.getBooleanValue());
          break;
        }
        case VALUE_NULL: {
          // write null
          nullFound(currentState);
          currentState = states.SCALAR_FOUND;
          currentPdxList.addNullField(null);
          break;
        }
        case VALUE_NUMBER_FLOAT: {
          // write double/float
          doubleFound(currentState);
          currentState = states.SCALAR_FOUND;
          // currentPdxList.addDoubleField(jp.getDoubleValue());
          setNumberField(jp, currentPdxList);
          break;
        }
        case VALUE_NUMBER_INT: {
          // write int
          intFound(currentState);
          currentState = states.SCALAR_FOUND;
          // currentPdxList.addIntField(jp.getIntValue());
          setNumberField(jp, currentPdxList);
          break;
        }
        case VALUE_STRING: {
          // write string
          stringFound(currentState);
          currentState = states.SCALAR_FOUND;
          currentPdxList.addStringField(jp.getText());
          currentFieldName = null;
          break;
        }
        case VALUE_TRUE: {
          // write bool
          boolFound(currentState);
          currentState = states.SCALAR_FOUND;
          currentPdxList.addBooleanField(jp.getBooleanValue());
          break;
        }
        default: {
          throw new IllegalStateException("Token not handled in getlist" + nt);
        }
      }
    }
  }
Converts a PdxInstance into a JSON document in byte-array form

@param pdxInstance The PdxInstance to convert
@return the JSON byte array
@throws JSONFormatterException if unable to create the JSON document
geode-core/src/main/java/org/apache/geode/pdx/JSONFormatter.java