Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate serde;
- extern crate serde_json;
- use serde_json::Value;
- struct DataIds
- {
- data: Vec<String>
- }
- fn main() {
- let jstr = r#"
- {
- "data": [["foo", "bar"], ["foo1", "bar1"]]
- }"#;
- let jvalue: Value = serde_json::from_str(jstr).unwrap();
- let jarray: Vec<_> = jvalue["data"].as_array().unwrap().to_vec();
- let jarray: Vec<_> = jarray.into_iter().map(|v| v.as_str().unwrap()).collect();
- println!("{}", jarray)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement