Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

isValidArray and JSONValidator can not valid a JSON Array #3453

@lyziew

Description

@lyziew

VERSION 1.2.73
String str = "[\n" +
" {\n" +
" "altitude": 109.0,\n" +
" "angle": 5.0,\n" +
" "index": 1,\n" +
" "type": 1\n" +
" },\n" +
" {\n" +
" "altitude": 1307.0,\n" +
" "angle": 5.0,\n" +
" "index": 2,\n" +
" "type": 1\n" +
" },\n" +
" {\n" +
" "altitude": 22.0,\n" +
" "angle": 7.0,\n" +
" "index": 3,\n" +
" "type": 1\n" +
" },\n" +
" {\n" +
" "altitude": 22.0,\n" +
" "angle": 7.0,\n" +
" "index": 4,\n" +
" "type": 2\n" +
" },\n" +
" {\n" +
" "altitude": 22.0,\n" +
" "angle": 7.0,\n" +
" "index": 5,\n" +
" "type": 2\n" +
" },\n" +
" {\n" +
" "altitude": 22.0,\n" +
" "angle": 7.0,\n" +
" "index": 6,\n" +
" "type": 2\n" +
" },\n" +
" {\n" +
" "altitude": 22.0,\n" +
" "angle": 7.0,\n" +
" "index": 7,\n" +
" "type": 2\n" +
" }\n" +
"]";
System.out.println(JSON.isValidArray(str)); // false
JSONValidator validator = JSONValidator.from(str);
validator.validate();
System.out.println(validator.getType()); // null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions