Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
YAML to JSON with Rust
// Yaml to JSON with Rust
// Dependencies serde_yaml and serde_json
fn main() {
let json_value: serde_json::Value = serde_yaml::from_str(&"
test: some value here
another: value here
- array
- another
".replace(" ", "")).unwrap();
println!("{}", serde_json::to_string_pretty(&json_value).unwrap());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment