# I was reading this post https://discourse.gohugo.io/t/unmarshall-error/53124/1 and came across a similar issue that’s been hard to resolve

**URL:** https://discourse.gohugo.io/t/i-was-reading-this-post-https-discourse-gohugo-io-t-unmarshall-error-53124-1-and-came-across-a-similar-issue-that-s-been-hard-to-resolve/53207
**Category:** support
**Created:** [January 20, 2025, 4:43pm UTC](https://discourse.gohugo.io/t/i-was-reading-this-post-https-discourse-gohugo-io-t-unmarshall-error-53124-1-and-came-across-a-similar-issue-that-s-been-hard-to-resolve/53207 "2025-01-20T16:43:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Shanegillis](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@Shanegillis](https://discourse.gohugo.io/u/Shanegillis)
#### Post date: [January 20, 2025, 4:43pm UTC](https://discourse.gohugo.io/t/i-was-reading-this-post-https-discourse-gohugo-io-t-unmarshall-error-53124-1-and-came-across-a-similar-issue-that-s-been-hard-to-resolve/53207/1 "2025-01-20T16:43:38Z")

</div>

I was reading this post [go](https://www.concretesrichmondva.com/)[hugo.io/t/unmarshall-error/53124](https://discourse.gohugo.io/t/unmarshall-error/53124) and came across a similar issue that’s been hard to resolve.

I’m trying to unmarshal a JSON string directly in a Hugo template, but I keep getting errors related to parsing, particularly when using `transform.Unmarshal`. The JSON structure looks valid, but it seems Hugo misinterprets it as YAML or CSV due to auto-detection issues. Here’s an example of the data:

```auto
[
  "abc123",
  "def456",
  "ghi789"
]

```

Even when wrapping it as a string and attempting to process it with `resources.FromString` or explicitly naming it as a JSON resource, I encounter inconsistent behavior. At times, the template processes it correctly, but other times, it throws errors like “bare ’ in non-quoted field” or fails silently.

What makes this more complicated is that the data source varies, and I cannot hard-code the resource name every time. I need a more dynamic and robust solution for handling JSON inputs, especially when Hugo’s auto-detection isn’t reliable.

Has anyone found a way to force Hugo to recognize JSON consistently without running into auto-detection conflicts? Any help or workarounds would be appreciated!

---

<div class="post-metadata">

### Author: ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)
#### Post date: [January 20, 2025, 6:08pm UTC](https://discourse.gohugo.io/t/i-was-reading-this-post-https-discourse-gohugo-io-t-unmarshall-error-53124-1-and-came-across-a-similar-issue-that-s-been-hard-to-resolve/53207/2 "2025-01-20T18:08:04Z")

</div>

you could wrap your array into a JSON map, unmarshal and extract the array.

```auto
{{ $string := `["abc123", "def456", "ghi789"]` }}
{{ $wrapped := add `{ "wrapped": ` $string "}" }}
{{ $json := transform.Unmarshal $wrapped }}
{{ $data := $json.wrapped }}
{{ highlight ($data | jsonify (dict "indent" " ")) "JSON" }}

```

* * *

todo: add error checking

or for the resource.FromString generate a SHA hash or other based on input as filename
