use serde::Deserialize; use serde_json; #[derive(Deserialize, Debug)] struct Todo { title: String, completed: bool, } fn main() { let json_data = r#" [ {"title": "Learn Rust", "completed": false}, {"title": "Write JSON parser", "completed": true} ] "#; let todos: Vec<Todo> = serde_json::from_str(json_data).unwrap(); for todo in todos { println!("{:?}", todo); } }