2

I have two entities with bidirectional relation

entity A {
   String name;
   Entity B b;
}

entity B {
   String name;
   int num;
   Entity A a;
}

with JsonManagedReference annotation, the serialized entity A will be

{ 
   name: xx,
   b: {
       name: yy,
       num: 1
      }
}

I'd like the entity A be serialized as

{ 
   name: xx,
   b: {
       name: yy,
       num: 1,
       a: xx
      }
}

or

{ 
   name: xx,
   b: {
       name: yy,
       num: 1,
       a: {name:xx}
      }
}

Which annotation should I use?

JasminDan
  • 523
  • 2
  • 6
  • 14
  • That's a circular reference problem: https://stackoverflow.com/questions/17393812/json-and-java-circular-reference – Haroldo_OK Jan 11 '18 at 17:02

0 Answers0