Nesting objects within other objects (in YAML) #460
micsport13
announced in
Announcements
Replies: 2 comments 2 replies
-
Going forward, please mention which format you are talking about: looking at output, I assume it is YAML. But beyond that, this sounds like an excellent Question for Discussions; I hadn't enabled Discussions yet for this repo, just did. Will convert. |
Beta Was this translation helpful? Give feedback.
0 replies
-
As to whether you can write multiple values at same level in output hierarchy: no, every |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First, if this is not the best place to put this kind of question, please let me know so I can put this somewhere else.
I have been trying to serialize this class using a custom serializer and I have been having some trouble being able to get it serialize correctly.
Here's the class I'm trying to serialize:
And here is the custom serializer:
Here's the desired output:
The constraint object is handled through annotations so I wasn't sure how to get it to just serialize the name provided in the annotation. If I try
jsonGenerator.writeObjectField("type", constraint.getKey())
, it wraps it with another "type" key instead of just providing the value. Any idea how to write another object within the same JsonObject?Beta Was this translation helpful? Give feedback.
All reactions