1
class SubClass {
    private String a1;    
    private String a2; 
}

class B {    
    private String b1;    
    private Subclass subclass;  
}

Can Jackson serialize the above 'class B' to a JSON which looks like:

{
   "/B/b1": "xxxxx",
   "/B/subclass/a1": "xxxxxx",
   "/B/subclass/a2": "xxxxxx"
}

i.e. all flattened to JSON pointer instead of the traditional tree structure.

clseto
  • 11
  • 1
  • Nope. Jackson offers something, and that's not it. I am not aware of some library that offers a kind of serialization like that, but there may be some. – kumesana Jan 17 '19 at 10:50

1 Answers1

0

No. You can write a custom serializer for Subclass type but what you want is not among existing serialization features.

Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111