# Not Getting keys from Json file using delimit function

**URL:** <https://discourse.gohugo.io/t/not-getting-keys-from-json-file-using-delimit-function/11796>\
**Category:** support\
**Created:** [May 1, 2018, 3:01pm UTC](https://discourse.gohugo.io/t/not-getting-keys-from-json-file-using-delimit-function/11796 "2018-05-01T15:01:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhutiyakishan1](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bhutiyakishan1/32/5856_2.png) [@bhutiyakishan1](https://discourse.gohugo.io/u/bhutiyakishan1)\
**Post date:** [May 1, 2018, 3:01pm UTC](https://discourse.gohugo.io/t/not-getting-keys-from-json-file-using-delimit-function/11796/1 "2018-05-01T15:01:43Z")

</div>

Hi there,  
I have json file like this :

```auto
{
   "hi-core/bower": {
       "name": "hi-core",
       "dependencies": {
            "showdown": "1.8.6",
           "moment": "2.22.1"
       }
}

```

I am trying to fetch the dependencies using a shortcode,which i am getting but i am getting like this:

> map[showdown-“1.8.6”]

I used delimit function so that map goes away but 'delimit ’ only gives me the value of the key and not the key itself(i.e just the ‘showdown’)!

Is there any way i can just get the keys of ‘dependencies’?

Any help is appreciated!  
Thanks!

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [May 1, 2018, 8:00pm UTC](https://discourse.gohugo.io/t/not-getting-keys-from-json-file-using-delimit-function/11796/2 "2018-05-01T20:00:46Z")

</div>

> [@bhutiyakishan1](#):
>
> I used delimit function

You need to use `range`.

If the map _map[showdown-“1.8.6”]_ is stored in `$foo`, do:

```auto
{{ range $key,$val := $foo }}
    <!-- $key will then hold "showdown" -->
    <!-- $val will hold "1.8.6" -->
{{ end }}

```

_“map[showdown-“1.8.6”]” is just how Go represents the map in string form… it’s not literally stored like that._

---

<div class="post-metadata">

**Author:** ![bhutiyakishan1](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bhutiyakishan1/32/5856_2.png) [@bhutiyakishan1](https://discourse.gohugo.io/u/bhutiyakishan1)\
**Post date:** [May 1, 2018, 8:45pm UTC](https://discourse.gohugo.io/t/not-getting-keys-from-json-file-using-delimit-function/11796/3 "2018-05-01T20:45:23Z")

</div>

> [@kaushalmodi](#):
>
> {{ range $key,$val := $foo }}

That worked for me! Thanks 🙂

---

<div class="post-metadata">

**Author:** ![bhutiyakishan1](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bhutiyakishan1/32/5856_2.png) [@bhutiyakishan1](https://discourse.gohugo.io/u/bhutiyakishan1)\
**Post date:** [May 1, 2018, 9:27pm UTC](https://discourse.gohugo.io/t/not-getting-keys-from-json-file-using-delimit-function/11796/4 "2018-05-01T21:27:02Z")

</div>

@kaushalmodi Is it true that i cant use delimit function with range?

I am trying to do this but looks like it doesnt work

```auto
<td> 
{{ range $key,$val := $cur }} 
{{ delimit ($key) ", " }} 
{{ end }}
</td>

```

Thanks!

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [May 1, 2018, 9:34pm UTC](https://discourse.gohugo.io/t/not-getting-keys-from-json-file-using-delimit-function/11796/5 "2018-05-01T21:34:19Z")

</div>

> [@bhutiyakishan1](#):
>
> Is it true that i cant use delimit function with range?

It depends what you are applying the `delimit` function to. It can be applied **only to** slices/maps. `$key` in that example is a string; it won’t work there.

See [collections.Delimit | Hugo](https://gohugo.io/functions/delimit/).

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [May 1, 2018, 9:37pm UTC](https://discourse.gohugo.io/t/not-getting-keys-from-json-file-using-delimit-function/11796/6 "2018-05-01T21:37:28Z")

</div>

May be you need to present that example JSON file and intended output, and ask what Go templating would be needed to go from that JSON to that output.
