# Rendering the JSON yourself

Source: https://help.ruuster.com/idx/guide-render-json-yourself

> Build your own cards and listing pages from the JSON while meeting every board's display rules, using the compliance objects the API returns and the SDK's checks.

You can design every card and page yourself instead of using the recipe components. The API tells you
exactly what each board requires and where, so your design can meet the rules without guessing.

## The two compliance objects

**`meta.mls`, on every answer:** one block per board in the answer.

| Field | What to do with it |
|---|---|
| `mlsName` | The board's name, for your disclaimer heading |
| `disclaimer.text`, `disclaimer.html` | The exact disclaimer. Print the HTML when it is set, else the text. |
| `logo` | `url`, `width`, `height` and `alt` of the board's logo, when it has one |
| `attributionTemplate` | How the board words attribution; the API has already filled it into each listing's `attribution.line` |
| `required` | Each element the board requires and where it goes: `{ element, placement }` |
| `notices` | Copyright, source and DMCA notices to print with the disclaimer |

**`compliance`, on a listing's detail answer:** the same rules for that one listing, filled in:
`attributionLine`, `courtesyLine`, `required`, `suppressedFields` (fields the board hides) and `asOf`.

## Elements and where they go

`required` names elements and placements:

| Element | What it is |
|---|---|
| `listing_office`, `listing_agent` | The listing office's or agent's name, from `attribution` |
| `agent_contact` | The agent's or office's email or phone, in `attribution.contact`, only on boards that require it. Show it; never use it to route leads. |
| `courtesy_line` | `attribution.courtesy`, such as "Listing courtesy of …" |
| `mls_logo` | The board's logo |
| `disclaimer` | The board's disclaimer |
| `as_of` | The date the data was last updated: `meta.freshness.asOf`, or the listing's `compliance.asOf` |
| `dmca_notice`, `source_line` | The notices in `notices` |

| Placement | Means |
|---|---|
| `card` | On every listing card, near the address |
| `detail` | On the listing page |
| `page` | Once on every page that shows the board's listings, usually at the bottom |
| `map` | Inside the map frame, whenever the map shows the board's listings |

## Checks the SDK runs for you

- `renderAttribution(listing, r.meta.mls)` returns the exact attribution text for a card.
- `assertDisplayable(listing, r.meta.mls, "card")` (or `"detail"`) throws a `DisplayRuleError` that
  names what your card is missing, so a test can catch it before launch.

## Rules for your own design

- Print each card's `attribution.line` when it is not null, near the address.
- Print every board's disclaimer, logo and notices on every page that shows its listings, and inside
  the map frame on map views, with the date the data was last updated.
- Use `address.display` for the address. When `address.hidden` is true, never show a street, a unit
  or a map pin, and use the id-only slug.
- Use `statusLabel` for the status. Turn `badges[].kind` into short labels of your own, such as "New"
  or "Price change".
- Show open houses in the listing's own time zone (`openHouses[].timeZone`).
- Never show a field the API didn't return, and never fill a missing field from another source.
- Never store listings beyond a cache, and drop a listing the moment the API stops returning it.

<figure class="idx-shot"><img src="/idx-docs/screens/ours/desktop-detail.png" alt="A listing page with the photo grid, the price block and the agent card" width="1440" height="900" loading="lazy" decoding="async"><figcaption>The detail recipe shows the gallery, price, facts and description.</figcaption></figure>

<figure class="idx-shot"><img src="/idx-docs/screens/ours/mls-disclaimers-1440.png" alt="The disclaimers of every board in the answer, and the Data last updated line, on a desktop (1440 px wide)" width="1440" height="900" loading="lazy" decoding="async"><figcaption>Attribution and the board's disclaimer at the end of a listing page.</figcaption></figure>

<figure class="idx-shot"><img src="/idx-docs/screens/ours/mls-disclaimers-375.png" alt="The disclaimers of every board in the answer, and the Data last updated line, on a phone (375 px wide)" width="375" height="812" loading="lazy" decoding="async"><figcaption>Attribution and the board's disclaimer at the end of a listing page.</figcaption></figure>

The markup is `static/html/mls-disclaimers.html` in `@ruuster/idx-recipes`. The [HTML and CSS recipe](https://help.ruuster.com/idx/recipe-html-css) shows how to fill it and which stylesheet and script to load.

## Before you launch

Run [Prompt: compliance and launch audit](https://help.ruuster.com/idx/prompt-launch-audit) against
your pages, and work through [Compliance: MUST and NEVER](https://help.ruuster.com/idx/compliance).
[Prompt: your own UI from the JSON](https://help.ruuster.com/idx/prompt-own-ui) builds a custom design
that meets these rules.
