Guest User

Untitled

a guest
Jun 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #[macro_use]
  2. extern crate serde_json;
  3.  
  4. fn main() {
  5. // The type of `john` is `serde_json::Value`
  6. let john = json!({
  7. "name": "John Doe",
  8. "age": 43,
  9. "phones": [
  10. "+44 1234567",
  11. "+44 2345678"
  12. ]
  13. });
  14.  
  15. println!("first phone number: {}", john["phones"][0]);
  16.  
  17. // Convert to a string of JSON and print it out
  18. println!("{}", john.to_string());
  19. }
Add Comment
Please, Sign In to add comment