Is it possible to mix an inline (json-like) map with regular map definitions for the same object?
Consider the following example:
person: {age: 32, weight: 82}
name: foo
The resulting person should have the given age, weight, and name.
EDIT: moved my solution to an answer
答案 0 :(得分:1)
可以通过使用合并标签:
person:
<<: {age: 32, weight: 82}
name: foo
结果是:
{
"person": {
"age": 32,
"name": "foo",
"weight": 82
}
}