static boolean isValid(byte[] bytes, int offset, int length, Charset charset) {
        if (bytes == null || bytes.length == 0 || length == 0) {
            return false;
        }

        try (JSONReader jsonReader = JSONReader.of(bytes, offset, length, charset)) {
            jsonReader.skipValue();
            return jsonReader.isEnd() && !jsonReader.comma;
        } catch (JSONException | ArrayIndexOutOfBoundsException error) {
            return false;
        }
    }
Verify that the json byte array is legal json text

@param bytes the specified array will be validated
@param offset the starting index of array
@param length the specified length of array
@param charset the specified charset of the bytes
@return {@code true} or {@code false}
core/src/main/java/com/alibaba/fastjson2/JSON.java