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.
Technically speaking, we could end up with an incorrect "path" recorded in a JsonDecodeException if someone escapes the decoder mechanism.
For instance.
This would record the path as
a.bnota.[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.