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

Merging to array entry #421

Open
dragonpiper opened this issue Dec 18, 2018 · 1 comment
Open

Merging to array entry #421

dragonpiper opened this issue Dec 18, 2018 · 1 comment

Comments

@dragonpiper
Copy link

dragonpiper commented Dec 18, 2018

Is currently supported ? Not sure if i'm using incorrect syntax

func main() {
    yamlStr := `
players: &players
    - Name: bob
      age: 18
  
fullPlayers: 
    - <<: *players
      Name: Dave`

    fmt.Println("Data Read\n", yamlStr)

    var data interface{}

    err := yaml.NewDecoder(strings.NewReader(yamlStr)).Decode(&data)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("%T %v\n", data, data)
}

Expecting

{
  "fullPlayers": [
    {
      "age": 18, 
      "Name": "Dave"
    }
  ], 
  "players": [
    {
      "age": 18, 
      "Name": "bob"
    }
  ]
}
@6543
Copy link

6543 commented Apr 28, 2023

my lib is going to support it: https://codeberg.org/6543/xyaml
and it's with in the yaml spec see answer

just in case anybody is interested ;)

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

2 participants