Skip to content

Can't dump non-plain objects #132

Open
@honzajavorek

Description

@honzajavorek

I need to convert "almost plain" objects to YAML. By "almost plain" I mean they're just data containers as if they were created by literals, but with different names. E.g. output of the protagonist library.

However, js-yaml fails on those with unacceptabe kind of an object to dump [object Result]. There could be an option to treat those as plain objects (json2yaml does this by default).

Workaround for this is to do

var yamlResult = yaml.safeDump(JSON.parse(JSON.stringify(result)));

...but that's not very efficient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions