> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqd.dev/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.sqd.dev/feedback

```json
{
  "path": "/en/sdk/squid-sdk/reference/openreader-server/api/json-queries",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# JSON queries

> Query entities with object-typed and JSON fields in OpenReader — Squid SDK GraphQL syntax for filtering and selecting nested JSON content.

The possibility of defining JSON objects as fields of a type in a GraphQL schema has been explained in the [schema reference](/en/sdk/squid-sdk/reference/schema-file).

This guide is focusing on how to query such objects and how to fully leverage their potential. Let's take the example of this (non-crypto related, for once😁) schema:

```graphql title="schema.graphql" theme={"system"}
type Entity @entity {
    id: ID!
    a: A
}

type A {
    a: String
    b: B
}

type B {
    a: A
    b: String
    e: Entity
}
```

It's composed of one entity and two JSON objects definitions, used in a "nested" way.

Let's now look at a simple query:

```graphql theme={"system"}
query {
    entities(orderBy: id_ASC) {
        id
        a { a }
    }
}
```

This will return a result such as this one (imagining this data exists in the database):

```graphql theme={"system"}
{
  entities: [
    {id: '1', a: {a: 'a'}},
    {id: '2', a: {a: 'A'}},
    {id: '3', a: {a: null}},
    {id: '4', a: null}
  ]
}
```

Simply enough, the first two objects have an object of type `A` with some content inside, the third one has an object, but its `a` field is `null` and the fourth one simply does not have an `A` object at all.
