Jackson contains YAML Dataformat module, which helps to work with this format. The example and tests in the repository are quite straighforward. However, I have a case that I struggle to implement at the moment.
Let's say I have a structure:
data class Department(val name: String, val employees: List<Employee>)
data class Employee(val firstName: String, val lastName: String, val age: Int)
I would like it to become a YAML with a structure:
departments:
I.T:
name: I.T
employees:
Steve Jobs:
firstName: Steve
lastName: Jobs
age: 24
Essentially, I would like the node name in YAML to be constructed from the value of the object. Is it possible at all?