dtolnay / serde-yaml

Strongly typed YAML library for Rust
Apache License 2.0
964 stars 164 forks source link

how can I merge 2 serde_yaml::Value? #411

Closed Masber closed 8 months ago

Masber commented 9 months ago

Dear serde_yaml community,

how can I merge 2 serde_yaml::Value?

eg

# yaml 1
---
value_1: 1
value_2:
  value_2_1: 21
  value_2_2: 22
value_3:
  - 1
  - 2
  - 3

and

# yaml 2
---
value_1: 10
value_2:
  value:2:1: 2
value_3:
  - 10
  - 20
  - 30

Would result in

# result
---
value_1: 10
value_2:
  value_2_1: 2
  value_2_2: 22
value_3:
  - 10
  - 20
  - 30

thank you

rtyler commented 8 months ago

Take a look at StackOverflow