# Search.json unexpected EOF when starting development server

**URL:** <https://discourse.gohugo.io/t/search-json-unexpected-eof-when-starting-development-server/40790>\
**Category:** support\
**Created:** [October 3, 2022, 6:59pm UTC](https://discourse.gohugo.io/t/search-json-unexpected-eof-when-starting-development-server/40790 "2022-10-03T18:59:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 3, 2022, 6:59pm UTC](https://discourse.gohugo.io/t/search-json-unexpected-eof-when-starting-development-server/40790/1 "2022-10-03T18:59:06Z")

</div>

Implementing web site search capabilities includes using this searh.json file:

```auto
{
  "results": [
    {{- range $index, $page := .Site.RegularPages }}
    {{- if $index -}} , {{- end }}
      {
        "href": {{ .Permalink | jsonify }},
        "title": {{ .Title | jsonify }},
        "body": {{ .Content | plainify | jsonify }}
      }
  
  ]
}

```

When I try to sart the hugo development server I get this error:

```auto
$ hugo server
Error: add site dependencies: load resources: loading templates:
".../themes/tikva/layouts/_default/search.json:13:1":
parse failed: template: _default/search.json:13: unexpected EOF

```

The file seems complete to me and I don’t understand why there’s an  
unexpected EOF when the enclusing braces match. Please educate me why this error exists.

---

<div class="post-metadata">

**Author:** ![regis](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/regis/32/4958_2.png) [@regis](https://discourse.gohugo.io/u/regis)\
**Post date:** [October 3, 2022, 8:21pm UTC](https://discourse.gohugo.io/t/search-json-unexpected-eof-when-starting-development-server/40790/2 "2022-10-03T20:21:10Z")

</div>

You need an end statement on that `range`… You should get a message but maybe because it’s `json` the error is not so explicit.

---

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 3, 2022, 8:50pm UTC](https://discourse.gohugo.io/t/search-json-unexpected-eof-when-starting-development-server/40790/3 "2022-10-03T20:50:14Z")

</div>

Thanks. I’ll look in my javascript book and learn how to add the ‘end’  
statement.

Rich

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 3, 2022, 8:58pm UTC](https://discourse.gohugo.io/t/search-json-unexpected-eof-when-starting-development-server/40790/4 "2022-10-03T20:58:49Z")

</div>

> [@rshepard](#):
>
> I’ll look in my javascript book

No.

[https://gohugo.io/templates/introduction/#iteration](https://gohugo.io/templates/introduction/#iteration)

---

<div class="post-metadata">

**Author:** ![rshepard](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rshepard](https://discourse.gohugo.io/u/rshepard)\
**Post date:** [October 3, 2022, 9:09pm UTC](https://discourse.gohugo.io/t/search-json-unexpected-eof-when-starting-development-server/40790/5 "2022-10-03T21:09:20Z")

</div>

Thank you, Joe.

Much appreciated,

Rich

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [October 5, 2022, 9:10pm UTC](https://discourse.gohugo.io/t/search-json-unexpected-eof-when-starting-development-server/40790/6 "2022-10-05T21:10:12Z")

</div>

Closed on October 5, 2022, 9:10pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
