INNER CODE UNIT · Java

parse

alibaba/fastjson2 · core/src/main/java/com/alibaba/fastjson2/JSON.java:400

    static Object parse(InputStream in, JSONReader.Context context) {
        if (in == null) {
            return null;
        }

        ObjectReader<?> objectReader = context.getObjectReader(Object.class);
        try (JSONReaderUTF8 reader = new JSONReaderUTF8(context, in)) {
            Object 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 stream as a {@link JSONArray} or {@link JSONObject}.
     * Returns {@code null} if received {@link InputStream} is {@code null} or empty.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…