Skip to content

Commit

Permalink
docs: updated basic post example
Browse files Browse the repository at this point in the history
  • Loading branch information
prmichaelsen authored Sep 5, 2023
1 parent 944caa8 commit 9549ebb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,16 @@ Furthermore, the promise exposes a `.json<T>()` function that returns `Promise<T
```js
import got from 'got';

const {data} = await got.post('https://httpbin.org/anything', {
json: {
const { body: data } = await got.post('https://httpbin.org/anything', {
json: true,
body: {
hello: 'world'
}
}).json();
});

console.log(data);
//=> {"hello": "world"}

```

For advanced JSON usage, check out the [`parseJson`](documentation/2-options.md#parsejson) and [`stringifyJson`](documentation/2-options.md#stringifyjson) options.
Expand Down

0 comments on commit 9549ebb

Please sign in to comment.