JSON-zu-Klassen-Generator

Wandle ein JSON-Beispiel in Modellklassen oder TypeScript-Interfaces um.

// about

Über dieses Tool

Das Tool erkennt die JSON-Struktur und erzeugt Startcode. Prüfe optionale Felder, verschachtelte Objekte, Namen und Typen.

So verwenden Sie es

  1. Füge ein JSON-Objekt oder Array ein.
  2. Wähle Sprache und Root-Klasse.
  3. Generiere, prüfe die Typen und kopiere den Code.

Warum dieses Tool genutzt wird

  • Wandle JSON-API-Antworten in Modelle um.
  • Erzeuge Code für fünf Sprachen.
  • Prüfe verschachtelte Objekte und Arrays.

Häufig gestellte Fragen (FAQ)

Ist das Modell produktionsfertig?

Es ist ein Ausgangspunkt. Prüfe Typen und Felder anhand deines API-Vertrags.

Ratgeber · Daten · 8 Min. Lesezeit

JSON-Syntaxfehler beheben: Die 7 häufigsten Fehler und wie Sie JSON aufräumen

API-Antworten, Konfigurationsdateien, Logs: JSON ist das Datenformat, das Entwickler am häufigsten lesen. Trotzdem kann ein einziges Komma oder Anführungszeichen einen „Unexpected token“-Fehler auslösen. So finden Sie die Ursache schnell.

JSON (JavaScript Object Notation) ist ein Textformat, das in RFC 8259 und ECMA-404 standardisiert ist. Es stammt aus JavaScript, wird heute aber von fast jeder Sprache unterstützt. Es gibt nur sechs Werttypen: String, Zahl, Boolean (true/false), null, Array und Objekt.

{
  "id": 1024,
  "name": "AIBIZAP",
  "active": true,
  "tags": ["tools", "guides"],
  "owner": null
}
JSON-Grundlagen, sieben häufige Parse-Fehler, Fallstricke bei großen Zahlen und Datumswerten und wie Sie JSON in Klassen oder Tabellen umwandeln.
Ratgeber lesen →
Mit KI bauen

Dieses Tool selbst mit KI bauen

Sie möchten eine eigene Version? Kopieren Sie den Arbeitsauftrag in einen KI-Chat oder speichern Sie die Skill-Datei für einen KI-Coding-Agenten. Beide enthalten die Funktionen, Sonderfälle und Testfälle, die wir verwendet haben.

Prompt und Skill sind auf Englisch, das KI-Tools in jeder Sprache gut verstehen.

KI-Arbeitsauftrag (Prompt)

Unverändert in Claude, ChatGPT oder Gemini einfügen.

You are an experienced full-stack web developer. Build a web tool called "JSON-zu-Klasse-Generator" that meets the requirements below.

## Goal

Build a tool that generates C#, Java, Python and TypeScript model classes from a JSON sample.

## Core features

- Choose C#, Java, Python dataclasses or TypeScript interfaces
- Create separate classes for nested objects
- Infer array element types
- Set the root class name
- Apply each language's naming conventions

## Inputs

- JSON sample
- Target language and root class name

## Outputs

- Generated code
- Summary of inferred types

## Edge cases and handling rules

- Treat null values as nullable types
- Merge differing keys across array elements
- Handle keys that clash with reserved words
- Keep original names for keys with digits or hyphens via serialization attributes

## Implementation requirements

- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.

## Definition of done (test cases)

- {"id":1,"name":"a"} gives int Id and string Name in C#
- Nested objects become separate classes
- Empty arrays become lists of object/any

First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.

Skill (SKILL.md)

Als .claude/skills/build-json-class-generator/SKILL.md speichern, damit Agenten wie Claude Code es bei jeder Änderung am Tool wiederverwenden.

---
name: build-json-class-generator
description: Use when building or changing a JSON-zu-Klasse-Generator tool. Build a tool that generates C#, Java, Python and TypeScript model classes from a JSON sample.
---

# Build: JSON-zu-Klasse-Generator

## Goal

Build a tool that generates C#, Java, Python and TypeScript model classes from a JSON sample.

## Workflow

1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.

## Core features

- Choose C#, Java, Python dataclasses or TypeScript interfaces
- Create separate classes for nested objects
- Infer array element types
- Set the root class name
- Apply each language's naming conventions

## Inputs

- JSON sample
- Target language and root class name

## Outputs

- Generated code
- Summary of inferred types

## Rules

- Treat null values as nullable types
- Merge differing keys across array elements
- Handle keys that clash with reserved words
- Keep original names for keys with digits or hyphens via serialization attributes
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.

## Verification

- [ ] {"id":1,"name":"a"} gives int Id and string Name in C#
- [ ] Nested objects become separate classes
- [ ] Empty arrays become lists of object/any

Tipps für die Arbeit mit KI

  • Nennen Sie in der ersten Zeile Ihren Stack (React, Vue oder reines HTML), damit der Code passt.
  • Lassen Sie die KI die Testfälle ausführen und die Ergebnisse zeigen, bevor Sie den Code übernehmen.
  • Fügen Sie keine echten Passwörter, Kundendaten oder API-Schlüssel ein; nutzen Sie Beispielwerte.