> For the complete documentation index, see [llms.txt](https://docs.superstructjs.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.superstructjs.org/resources/faq.md).

# FAQ

Some common questions you might have when first learning Superstruct.

### How can I allow unknown keys with `object` structs?

The [`object`](/api-reference/types.md#object) struct validates that a value matches a known object shape. Just like it's TypeScript counterpart, it does not allow unknown keys—this is very useful in catching bugs in the majority of cases.

However, there are cases where you'd like to validate a set of properties but ignore any unknown ones. For that you can use the [`type`](/api-reference/types.md#type) struct which is more generic, and acts similar to TypeScript's structural typing in that it does not care about any extra properties.

### Why not have a built-in `json` struct?

The problem with a built-in `json` struct is that it needs to recursively iterate through deep objects to guarantee they're valid JSON. What's wrong with that? Nothing, except that it would be a footgun.

The cases where you receive a truly unknown object, and you need to validate nothing about its content other than that it is pure JSON are very rare. In those cases, it's not hard to write a `json` utility yourself.

Instead, people would mistakenly use `json` in places where they really meant, "some object I don't care about", without realzing the performance penalty—use [`unknown`](/api-reference/types.md#unknown) or [`object`](/api-reference/types.md#object) instead.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.superstructjs.org/resources/faq.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
