# JSON array with objects implode

**URL:** <https://discourse.gohugo.io/t/json-array-with-objects-implode/3615>\
**Category:** support\
**Created:** [July 4, 2016, 10:59am UTC](https://discourse.gohugo.io/t/json-array-with-objects-implode/3615 "2016-07-04T10:59:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashpixx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/flashpixx/32/1795_2.png) [@flashpixx](https://discourse.gohugo.io/u/flashpixx)\
**Post date:** [July 4, 2016, 10:59am UTC](https://discourse.gohugo.io/t/json-array-with-objects-implode/3615/1 "2016-07-04T10:59:21Z")

</div>

Hello,

I have got a JSON document like

```
{
      author : [
          { given : "a", family : "b" }, { given : "c", family : "d" }
      ]
}

```

and I try to crete within my template a coma delimited list, so I do

{{ delimit ( apply $item.author ( print “.given” ", " “.family” ) “.” ) ", " }}

but this does not work, so I would like to get: a b, c d  
How can I get a correct delimited string list from my objects?

Thanks

Phil

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [July 4, 2016, 1:19pm UTC](https://discourse.gohugo.io/t/json-array-with-objects-implode/3615/2 "2016-07-04T13:19:41Z")

</div>

I suggest you break it up into smaller parts and read the documentation carefully. Not sure what you expect from the print func, for starters.

---

<div class="post-metadata">

**Author:** ![flashpixx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/flashpixx/32/1795_2.png) [@flashpixx](https://discourse.gohugo.io/u/flashpixx)\
**Post date:** [July 4, 2016, 1:32pm UTC](https://discourse.gohugo.io/t/json-array-with-objects-implode/3615/3 "2016-07-04T13:32:41Z")

</div>

I try this, but I’m failing on the print command. I try to do it with

```
{{ $authorlist := " " }}
{{ range $item := $json.author }}
    {{ $authorlist := (print $authorlist $item.given " " $item.family ", ") }}
{{ end }}
<em>{{ slice $authorlist 0 -2 }}</em>

```

At the em command the variable $authorlist is empty, exactly it has the value before the range call. If I do the output within the range I get the result, but I need the full concatinated list of all elements within the JSON list.

Thx

Phil

---

<div class="post-metadata">

**Author:** ![flashpixx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/flashpixx/32/1795_2.png) [@flashpixx](https://discourse.gohugo.io/u/flashpixx)\
**Post date:** [July 4, 2016, 5:58pm UTC](https://discourse.gohugo.io/t/json-array-with-objects-implode/3615/4 "2016-07-04T17:58:16Z")

</div>

I just try it with

```
{{ range $publication.author }}
     <em>{{ print .given " " .family ", " }}</em>
{{ end }}

```

This works, but I get a trailing ; at the end (and I would like to remove it), but on

```
{{ apply $publication.author (print .given " " .family ", ") "." }}

```

I get the error `at <apply $publication.a...>: error calling apply: can't find function <nil> <nil`
