jdevelop
jdevelop

Reputation: 12306

serialize String property as nested JSON object

I need the String property of object to be serialized as nested JSON without any escaping etc. So given json:

{
  "regularProperty" : "Test here",
  "nestedJSON" : {
    "propertyArray" : [1,2,3],
    "propertyText" : "new Text",
    "anotherObject" : { ... }
  }
}

And the nestedJSON property must contain the text

{
  "propertyArray" : [1,2,3],
  "propertyText" : "new Text",
  "anotherObject" : { ... }
}

How is it possible for both serialization/deserialization? Any specific annnotation or data type?

Upvotes: 2

Views: 946

Answers (1)

nutlike
nutlike

Reputation: 4975

Maybe add the annotation JsonRawValue on the nestedJSON field? I never used it before but it seems quite promising for your case.

Upvotes: 4

Related Questions