Questions tagged [jsonidentityinfo]

17 questions
10
votes
3 answers

Jackson: @JsonIdentityInfo Object instead of id

Is there a way to influence the serialization process with @JsonIdentityInfo so that it inserts the whole object instead of referencing the id? @Entity @JsonIdentityInfo( generator = ObjectIdGenerators.IntSequenceGenerator.class, …
Rooky
  • 810
  • 3
  • 12
  • 20
10
votes
2 answers

deserialize Jackson object in JavaScript containing JsonIdentityInfo

hello (sorry for my english) I'm working on angularjs front end website consuming web service producing json with SPRING MVC. The spring mvc use JsonIdentityInfo option for seralization so each object are writed only one time in the json and each…
AlainIb
  • 4,544
  • 4
  • 38
  • 64
5
votes
0 answers

Jackson @jsonidentityinfo change the original data structure

I have below 2 classes with circular reference,I didn't put getters and setters for convenience @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "i") public class A{ int i; B b1; B…
Shuai
  • 51
  • 3
4
votes
1 answer

jackson's @JsonIdentityInfo with breadth first

I am using Jackson's @JsonIdentityInfo for removing circular objects from JSON. Suppose following is Java Classes Class A, B, C and following is structure, Class A{ int id; B b; C c; } Class B{ int id; C c; } My object is …
Akshay
  • 3,558
  • 4
  • 43
  • 77
4
votes
1 answer

JsonMappingException: Infinite recursion on OneToMany Relationship in Objectify

To serve a backend for an Android App i am using Google App Engine together with Objectify (4.0.3b). On the backend I have a simple User Entity, which has a list of Users (friends) as relationship. @Entity public class User { @Id private…
ice_chrysler
  • 2,633
  • 1
  • 21
  • 27
3
votes
0 answers

JsonIdentityInfo causes objects to be serialized as Ids, and then cant deserialize them

I have a problem with array deserialization when using JsonIdentityInfo. The serialization takes place correctly and the array contains a few Ids where there are cyclic references. However, I cannot figure out how to deserialize the ids into…
Sagar Kapadia
  • 105
  • 1
  • 9
3
votes
3 answers

JsonIdentityInfo Resolver instantiated in Spring Context

How can I register an ObjectIdResolver to an Spring/Jackson object mapper so that the ObjectIdResolver class gets instantiated by Spring? I would like to use dependency injection in my ObjectIdResolver class. ObjectIdResolver.java @Component public…
Manuel
  • 51
  • 1
  • 3
2
votes
0 answers

Hide Object reference in JSON serialization by Jackson when using @JsonIdentityInfo

I have two entities: Category and Item. Category Entity: @JsonInclude(Include.NON_EMPTY) @JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class) @Entity public class Category { @Id @GeneratedValue private int id; …
Shaiful
  • 928
  • 1
  • 10
  • 11
2
votes
1 answer

jackson's JsonIdentityInfo generates plain numbers

Using Spring, 3.2.7, Hibernate 4.2.12, Jackson 2.3.3 And experimenting with references in jackson using JsonIdentityInfo. I have an entity taxanomy, with a parent and children, both references to Taxanomy…
dr jerry
  • 9,768
  • 24
  • 79
  • 122
1
vote
0 answers

JsonIdentityReference with alwaysAsId true with null property throws Null Pointer Exception

I have two classes PaymentDetailsDTO and UserDTO. I want to serialize only the id field (a Long) of UserDTO present inside PaymentDetailsDTO. I am using Jackson annotations @JsonIdentityInfo and @JsonIdentityReference(alwaysAsId = true). The problem…
Omkar Manjrekar
  • 103
  • 1
  • 11
1
vote
0 answers

Best way of handling Jackson bi-directional references

I'm trying to build rest APIs for our core components using Jackson, and I had issues with some of the objects getting this exception: javax.ws.rs.ProcessingException: com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion…
zbeedatm
  • 601
  • 1
  • 15
  • 39
1
vote
1 answer

Force a property to serialize into identity in Jackson

I have a class with (disclaimer, I am writing in Kotlin, but I translate it into Java so more people can read it) @JsonIdentityInfo( ObjectIdGenerators.PropertyGenerator.class, "id" ) public class Foo implements Serializable { public…
Joald
  • 1,114
  • 10
  • 32
1
vote
1 answer

How to replace JsonIdentityInfo's id with the full object?

My question is similar to deserialize Jackson object in JavaScript containing JsonIdentityInfo but I'm working with Java and I'm asking about jackson specifically, not 3rd party stuff. I'm sending JSON from the server to the client. To save space…
Mark
  • 2,167
  • 4
  • 32
  • 64
1
vote
0 answers

Avoid circular self references in hibernate entity

I have a Hibernate entity with self references @Entity @Table(name = "category") @NamedQuery(name = "Category.findAll", query = "SELECT c FROM Category c") public class Category implements Serializable { private static final long serialVersionUID =…
abi_pat
  • 572
  • 2
  • 12
  • 35
1
vote
1 answer

JsonIdentityInfo use for hibernate mapping

I have two entities City and Type and a many-to-many relationship between these two. What I need is: a json for City which contains the types a json for Type which contains the cities. I am using JsonIdentityInfo to stop the infinite recursion…
1
2