a11y.skipToMainContent
1

JSON à aller struct

Coller un échantillon JSON et obtenir la correspondance Go struct définitions — avec option <code>json:"..."</code> tags, <code>omitvide</code>, et les champs pointeurs pour les valeurs nulles.

More options
Was this tool helpful?
Send output to:
Advertisement

How to use JSON to Go Struct

  1. Coller un objet JSON (ou cliquer sur Charger l'échantillon).
  2. Choisissez un nom de structure racine (par défaut : Root).
  3. Tick json struct tags, omitvide, ou pointeur-pour-facultatif si vous voulez.
  4. Copiez le code Go généré directement dans votre projet.

Quel est {nom} ?

Enregistrez la plaque de chaudière des structures d'écriture à la main pour toute API tierce. Le générateur infère des types (int64, float64, bool, string) et génère récursivement une structure pour chaque objet niché, y compris des tableaux d'objets. Ajouter json struct tags donc Go encoding/json package maps fields automatiquement.

Advertisement

FAQ

Les objets imbriqués sont-ils pris en charge?
Oui — chaque objet imbriqué devient sa propre structure typée.
Mon JSON est-il téléchargé quelque part ?
C'est pas vrai. La conversion fonctionne entièrement dans votre navigateur. Rien n'est envoyé à un serveur.

Related tools

Author

MW
Marcus Webb"The DevTool Craftsman"

Full-Stack Developer & Tools Architect

Marcus has been writing code since the dial-up era. He has contributed to open-source developer tools, built CI/CD pipelines for startups, and debugged production incidents at 3 AM more times than he would like to admit. His philosophy is that the best developer tool is the one that gets out of your way, and he writes about practical tooling that helps teams ship faster with fewer headaches.

← Back to Developer Tools · All tags

Last updated:

Advertisement