Skip to content

Investigate situations where JsonDecodeException might give a wrong result for path #14

@bowbahdoe

Description

@bowbahdoe

Technically speaking, we could end up with an incorrect "path" recorded in a JsonDecodeException if someone escapes the decoder mechanism.

For instance.

Json j = Json.readString("""
    {
      "a": [
         {
            "b": 123
         }
      ]
    }
""");

List<String> b = JsonDecoder.field(j, "a", a -> {
    var array = JsonDecoder.array(a);
    return array.stream()
        .map(JsonDecoder::string)
        .toList();
} 

This would record the path as a.b not a.[0].b. There might not be a nice way to account for this in general, at least without propagating metadata to the actual Json forms.

Maybe metadata is valid to propagate though! There could be more uses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions