Clicking on object in metadata overwrites it to [Object object]

If you use the Properties UI at all, the YAML will be reformatted.

Here are two relevant topics about this (there may be more):

and