Skip to content

Further discussion of schema-based parsing. #47

@ZhaiMo15

Description

@ZhaiMo15

Good to know that the schema-based parsing were implemented!
I have two more questions:

  1. As line 54 in src/main/java/org/simdjson/SchemaBasedJsonIterator.java says: "Lists at the root are not supported. Consider using an array instead.". So current version cannot handle the case? For example, github_events.json.
  2. Can the schema-based parsing be more powerful?
    In current version, we need to explicitly tell the parser the class:
SimdJsonTwitter twitter = simdJsonParser.parse(buffer, buffer.length, SimdJsonTwitter.class);

record SimdJsonUser(boolean default_profile, String screen_name) {
}

record SimdJsonStatus(SimdJsonUser user) {
}

record SimdJsonTwitter(List<SimdJsonStatus> statuses) {
}

In Jackson, we can use readValue to parse json into Map (or List), in that case, we don't need to define lots of "record" if the class is complicated.
In one word, something like Object twitter = simdJsonParser.parse(buffer, buffer.length, Map.class);

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