mirror of
https://github.com/actix/actix-website
synced 2024-11-30 11:12:57 +01:00
docs: add dependence of example (#213)
This commit is contained in:
parent
de54bf6b56
commit
350fe31475
@ -29,6 +29,19 @@ that accepts `Json<T>` as a parameter, then, you use the `.to()` method for regi
|
||||
this handler. It is also possible to accept arbitrary valid json object by
|
||||
using `serde_json::Value` as a type `T`.
|
||||
|
||||
First example of json of `JSON Request` depends on `serde`:
|
||||
```toml
|
||||
[dependencies]
|
||||
serde = "1"
|
||||
````
|
||||
Second example of `JSON Request` depends on `serde` and `serde_json`:
|
||||
```toml
|
||||
[dependencies]
|
||||
serde = "1"
|
||||
serde_json = "1"
|
||||
```
|
||||
If you want to add default value for a field, refer to `serde`'s [documentation](https://serde.rs/attr-default.html).
|
||||
|
||||
{{< include-example example="requests" file="main.rs" section="json-request" >}}
|
||||
|
||||
You may also manually load the payload into memory and then deserialize it.
|
||||
|
Loading…
Reference in New Issue
Block a user