<p>No, I don't think so. If you think about it, assets are always an array so treat them consistently as such, even if you've set a limit of one. If the backend limit changes, it won't screw with your setup, either.</p>

CC BY-SA 4.0
2021-12-03T22:29:05.593Z
2021-12-03T22:29:05.593Z
Clive Portman
<p>Consider the following GraphQL query:</p>
<pre><code>{
  entries {
    ...on posts_default_Entry {
      image {
        id
      }
    }
  }
}
</code></pre>
<p>This will return the following:</p>
<pre><code>{
  &quot;data&quot;: {
    &quot;entries&quot;: [
      {
        &quot;image&quot;: [
          {
            &quot;id&quot;: &quot;11010&quot;
          }
        ]
      }
    ]
  }
}
</code></pre>
<p>However, since the <code>image</code> field is limited to 1 image, it doesn't make sense for it to be an array. I would prefer that the query returned the following instead:</p>
<pre><code>{
  &quot;data&quot;: {
    &quot;entries&quot;: [
      {
        &quot;image&quot;: {
          &quot;id&quot;: &quot;11010&quot;
        }
      }
    ]
  }
}
</code></pre>
<p>Is this possible?</p>

<graphql>
Return a single element instead of an array in a GraphQL query
# Return a single element instead of an array in a GraphQL query

(Asked by: username_0 on 2021-12-02)

Consider the following GraphQL query:
{
  entries {
    ...on posts_default_Entry {
      image {
        id
      }
    }
  }
}

This will return the following:
{
  "data": {
    "entries": [
      {
        "image": [
          {
            "id": "11010"
          }
        ]
      }
    ]
  }
}

However, since the image field is limited to 1 image, it doesn't make sense for it to be an array. I would prefer that the query returned the following instead:
{
  "data": {
    "entries": [
      {
        "image": {
          "id": "11010"
        }
      }
    ]
  }
}

Is this possible?

**Tags:** graphql


---

## 1 answers

### Answer by username_1 on 2021-12-03. Score: 2 | Accepted answer

No, I don't think so. If you think about it, assets are always an array so treat them consistently as such, even if you've set a limit of one. If the backend limit changes, it won't screw with your setup, either.


---

