Feature
When accessing an object as record using to(Class) the record accessor should support record components that are not nested in terms of the input JSON. When such a component is marked (e.g. with an annotation) the name of the component is irrelevant as the same JSON object of the outer record is given to the inner record. This allows to map a "flat" JSON object to a structured "tree" of records. This is mostly useful and needed as records do not allow composition by inheritance. With this they can allow for composition by reusing structures as nested components.
Implementation
It might be as easy as checking for the marker in JsonAccess#accessAsRecord and if the marker is present instead of
JsonMixed cValue = obj.get(c.getName());
the component JSON value is simply
So together
JsonMixed cValue = hasMarker(c) ? obj : obj.get(c.getName());
Feature
When accessing an object as
recordusingto(Class)the record accessor should supportrecordcomponents that are not nested in terms of the input JSON. When such a component is marked (e.g. with an annotation) the name of the component is irrelevant as the same JSON object of the outer record is given to the inner record. This allows to map a "flat" JSON object to a structured "tree" of records. This is mostly useful and needed asrecords do not allow composition by inheritance. With this they can allow for composition by reusing structures as nested components.Implementation
It might be as easy as checking for the marker in
JsonAccess#accessAsRecordand if the marker is present instead ofthe component JSON value is simply
So together