static Object parse(String text) {
        if (text == null || text.isEmpty()) {
            return null;
        }

        ObjectReaderProvider provider = JSONFactory.getDefaultObjectReaderProvider();
        final JSONReader.Context context = new JSONReader.Context(provider);
        try (JSONReader reader = JSONReader.of(text, context)) {
            Object object;
            char ch = reader.current();

            if (context.objectSupplier == null
                    && (context.features & UseNativeObject.mask) == 0
                    && (ch == '{' || ch == '[')
            ) {
                if (ch == '{') {
                    JSONObject jsonObject = new JSONObject();
                    reader.read(jsonObject, 0);
                    object = jsonObject;
                } else {
                    JSONArray array = new JSONArray();
                    reader.read(array);
                    object = array;
                }
                if (reader.resolveTasks != null) {
                    reader.handleResolveTasks(object);
                }
            } else {
                ObjectReader<?> objectReader = provider.getObjectReader(Object.class, false);
                object = objectReader.readObject(reader, null, null, 0);
            }
            if (reader.ch != EOI && (context.features & IgnoreCheckClose.mask) == 0) {
                throw new JSONException(reader.info("input not end"));
            }
            return object;
        }
    }
Parses the json string as a {@link JSONArray} or {@link JSONObject}.
Returns {@code null} if received {@link String} is {@code null} or empty.

@param text the specified text to be parsed
@return either {@link JSONArray} or {@link JSONObject} or null
@throws JSONException If a parsing error occurs
core/src/main/java/com/alibaba/fastjson2/JSON.java