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

# Create number and JSON flags

> Serve numeric settings and JSON payloads with getNumber and getJson.

## Overview

Number and JSON flags serve values instead of on/off. In this guide you add `max-retries` (a number) and `checkout-payload` (a JSON object), push them, and read them in code.

## Define them

```ts TypeScript theme={null}
// shipd.config.ts
import { defineFlags } from "shipdit/config";

export default defineFlags({
  "max-retries": {
    type: "number",
    default: 3,
    description: "Max retries for outbound API calls",
  },
  "checkout-payload": {
    type: "json",
    default: { mode: "strict", showPromo: true },
    description: "Checkout UI settings",
  },
});
```

```go Go theme={null}
// Entries inside config.ShipdConfig (import github.com/alasti-company/useshipd.com/sdks/go/config).
"max-retries": {Type: "number", Default: 3},
"checkout-payload": {Type: "json",
    Default: map[string]any{"mode": "strict", "showPromo": true}},
```

For Go, add definitions to `Config` in `shipd.config.go`, then run `shipd push`. See [Define flags in code](/config-as-code/define-flags#go-definitions) for the complete file.

```bash theme={null}
shipd push --project web-app --env production
```

## Read a number

```ts TypeScript theme={null}
// src/invoices.ts
const retries = shipd.getNumber("max-retries");
await fetchInvoice(id, { retries });
```

```go Go theme={null}
// invoices.go
retries := client.GetNumber("max-retries", shipd.EvaluationContext{})
// GetNumber returns float64. Validate and convert it for your application's API.
```

In React, use `useNumber("max-retries")`. See [React bindings](/sdks/react).

See [`getNumber`](/reference/sdk#getnumber).

## Read JSON

```ts TypeScript theme={null}
// src/checkout.ts
const ui = shipd.getJson("checkout-payload");
// typed from the default's shape in FlagDefinitions
```

```go Go theme={null}
// checkout.go
ui := client.GetJSON("checkout-payload", shipd.EvaluationContext{})
payload, ok := ui.(map[string]any)
if ok {
    mode, _ := payload["mode"].(string)
    _ = mode
}
```

In React, use `useJson("checkout-payload")`.

Code against that shape and keep values served from the dashboard compatible with it. See [`getJson`](/reference/sdk#getjson).

## Change the value

On the flag page in the dashboard, set **Fallthrough** to a new value, or add a rule that serves a different value to some users. Click **Save environment**.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.