Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML support? #88

Open
s3rj1k opened this issue Oct 26, 2020 · 2 comments
Open

YAML support? #88

s3rj1k opened this issue Oct 26, 2020 · 2 comments

Comments

@s3rj1k
Copy link

s3rj1k commented Oct 26, 2020

Can I use this library for interacting with dynamic YAML?

@Jeffail
Copy link
Owner

Jeffail commented Oct 26, 2020

Hey @s3rj1k, yes as long as the parsed structure contains map[string]interface{} map types and not map[interface{}]interface{}. If you're using gopkg.in/yaml.v3 then that will be the case unless there are non-string key types within your structure, which often isn't the case. However, earlier versions of gopkg.in/yaml are different in that they always parse map[interface{}]interface{} when provided an empty interface, which won't work with gabs.

@alex-shpak
Copy link

Hi @Jeffail !
In order to support yaml.v2 do you think it would be reasonable to add

else if mmap, ok := object.(map[interface{}]interface{}); ok { ... }

in https://github.com/Jeffail/gabs/blob/master/gabs.go#L141
more-less copy-pasting previous block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants