# Decode JSON Nested Objects

**URL:** <https://forum.elixirforum.com/t/decode-json-nested-objects/34157>\
**Category:** Questions\
**Tags:** phoenix, json, poison\
**Created:** [September 3, 2020, 7:37pm UTC](https://forum.elixirforum.com/t/decode-json-nested-objects/34157 "2020-09-03T19:37:59Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![zzq](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/z/49beb7/32.png) [@zzq](https://forum.elixirforum.com/u/zzq)\
**Post date:** [September 6, 2020, 3:06pm UTC](https://forum.elixirforum.com/t/decode-json-nested-objects/34157/4 "2020-09-06T15:06:38Z")

</div>

You can use the `:as` option to `Poison.decode`. That would be something along the lines of:

```elixir
Poison.decode(
     json_string,
     as: %{
        "_embeded" => %{
            "collection_currently" => [%CollectionCurrently{}]
        }
     }
)

```

(Assuming that you have defined an appropriate `CollectionCurrently` struct which derives `Poison.Encoder`.)

The idea here is that the `:as` option expresses the structure of the data you want to decode. If in addition to the `collection_currently` list you want to decode the other parts (`page` and `_links`) in addition, you can include them in the `:as` as well.

---

_[View the full topic](https://forum.elixirforum.com/t/decode-json-nested-objects/34157)._
