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

# JSON Compatibility

Internet Object is designed to be friendly to JSON. A large subset of JSON values parses directly, and most Internet Object data converts cleanly to JSON.

## JSON parses as Internet Object

Quoted-key object syntax and quoted strings, arrays, numbers, booleans, and `null` are valid Internet Object. A JSON object can be used as a record as-is:

```ruby
---
{"name": "John", "age": 30, "active": true}
```

The idiomatic Internet Object form drops the quotes and repeated keys by moving them into the schema:

```ruby
name, age, active: bool
---
John, 30, true
```

## Differences

* **Keys** — Internet Object keys may be unquoted; JSON requires quotes. Both are accepted.
* **Booleans / null** — Internet Object also allows the compact forms `T`, `F`, `N`.
* **Comments** — Internet Object allows `#` comments; JSON does not. Comments are dropped when converting to JSON.
* **Schema** — Internet Object carries an optional schema/header that JSON has no equivalent for; on conversion it becomes external (or is dropped).

## Lossy cases (IO → JSON)

Some Internet Object types have no exact JSON counterpart and convert approximately:

| Internet Object              | JSON representation                                              |
| ---------------------------- | ---------------------------------------------------------------- |
| `decimal` (`1.50m`)          | number or string (precision/scale not preserved by JSON numbers) |
| `bigint` (`123n`)            | number (may lose precision) or string                            |
| `datetime` / `date` / `time` | ISO-8601 string                                                  |
| `binary` (`b'…'`)            | base64 string                                                    |
| `NaN`, `Inf`, `-Inf`         | not representable in JSON (often `null` or a string)             |

For exact round-trips, keep the data in Internet Object form.

## See Also

* [Converting To/From Other Formats](/interoperability/conversions.md)
* [Why Internet Object?](/internet-object/why-internet-object.md)


---

# 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:

```
GET https://docs.internetobject.org/interoperability/json-compatibility.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
