Skip to content

Json Flattening #62

@TheNitesWhoSay

Description

@TheNitesWhoSay

RareJson should support opt-in (with annotations) flattening of super classes and nested objects.

e.g.

struct Parent { int a; ... }
struct Child : Parent { int b; ... }

Which today when writing child would come out something like...

{
  "b": 12345,
  "parent": {
    "a": 12345
  }
}

Should be possible to instead have written like...

{
  "a": 12345,
  "b": 12345
}

Some of the challenges identified earlier were as follows:

1.) Flattening should potentially apply recursively, pulling the hierarchy of ancestor classes into sub-classes if directed to do so
2.) Data-hiding and naming collisions need to be accounted for
3.) Open questions of whose field clusters unknown fields belong to
4.) There's no reason flattening couldn't also apply to regular fields of certain types, such as nested reflected objects
5.) There's a huge amount of logic changes related to pretty print and affixing that this would necessitate - you can no longer rely on analysis of the current object to tell if something is the first field

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions