MyJSON
Power tools

Code generation

JSON → TypeScript / Zod / Go / Rust / Python / JSON Schema.

Code tab in the toolbar.

How it works

MyJSON walks your document and infers a shape per language — common keys in arrays become required, divergent keys become optional, divergent value types union into anyOf. Names use PascalCase (TypeScript/Go/Rust) or snake_case (Python). For arrays of dissimilar objects, you get a clean union type.

Target languages

TypeScript interfaces, Zod schemas (with `z.infer<T>`), Go structs with `json:` tags (and `omitempty` on optionals), Rust structs with `#[derive(Serialize, Deserialize)]`, Python dataclasses, Pydantic v2 models, raw JSON Schema.

Examples

Generate a Go struct for a Stripe webhook

You're writing a webhook handler in Go.

  1. Paste the webhook payload.
  2. Code tab → pick Go.
  3. Output is ready to paste into a `types.go`.
Input (json)
{
  "user": {
    "id": "usr_8a4f1e",
    "name": "Jane Doe",
    "email": "jane.doe@example.com",
    "skills": ["TypeScript", "React"],
    "active": true,
    "lastSeen": "2026-05-07T09:14:00Z"
  }
}
Output (go)
package main

type Root struct {
	User User `json:"user"`
}

type User struct {
	Id       string   `json:"id"`
	Name     string   `json:"name"`
	Email    string   `json:"email"`
	Skills   []string `json:"skills"`
	Active   bool     `json:"active"`
	LastSeen string   `json:"lastSeen"`
}