From 68a4a3e63eb466fba38576ee8b163d18de50cd27 Mon Sep 17 00:00:00 2001 From: Ben <687794+benjaminmcdonald@users.noreply.github.com> Date: Tue, 15 Jan 2019 05:07:04 +0900 Subject: [PATCH] Add json fetch example to readme (#438) Closes #428 --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index d7460af..8d6e38a 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,21 @@ On Windows and macOS: Reqwest uses [rust-native-tls](https://github.com/sfackler/rust-native-tls), which will use the operating system TLS framework if available, meaning Windows and macOS. On Linux, it will use OpenSSL 1.1. +## Example + +Fetch json + +```rust +extern crate reqwest; +#[macro_use] extern crate serde_json; + +fn main() { + let mut reqwest_responce = reqwest::get("https://jsonplaceholder.typicode.com/todos/1").unwrap(); + let jsonplaceholder: serde_json::Value = reqwest_responce.json().unwrap(); + println!("{:#?}", jsonplaceholder); +} +``` + ## License Licensed under either of