# Are JSON numbers integers or floats?

**A single object shape.**

## Input

```json
{
  "count": 10,
  "ratio": 0.75,
  "id": 1000000
}
```

## TypeScript

```typescript
export interface Root {
  count: number;
  ratio: number;
  id: number;
}
```

## Zod

```typescript
import { z } from 'zod';

export const RootSchema = z.object({
  count: z.number(),
  ratio: z.number(),
  id: z.number(),
});
```

## Warnings

### Whole numbers are still `number` (info)

Every numeric value in the sample was a whole number, but JSON has a single number type and cannot express the difference. The output uses `number`.

**Fix:** If a field is genuinely an integer, tighten it by hand: `z.number().int()`.

---

Canonical URL: https://json-to-types.gumballtools.com/types/json-numbers-integer-or-float
JSON API: `POST https://json-to-types.gumballtools.com/api/v1/convert`
MCP endpoint: `https://json-to-types.gumballtools.com/api/mcp`
