Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Convert JSON to Go StructNew to Visual Studio Code? Get it now.
Convert JSON to Go Struct

Convert JSON to Go Struct

Thiago Santos

| (0) | Free
Convert JSON into Go struct definitions and copy the result to the clipboard.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

JSON to Go Struct

A Visual Studio Code extension that converts JSON into Go struct definitions.

Using

Usage

  1. Open a JSON document in VS Code, or select a JSON value.
  2. Run Convert JSON to Go Struct from the Command Palette, the JSON editor context menu, or Ctrl+Alt+G (Cmd+Alt+G on macOS).
  3. Paste the generated Go code from the clipboard.

The command prefers non-empty selected text and otherwise converts the complete active document. It supports objects, nested objects, primitive and object arrays, top-level arrays, and top-level primitives. Empty or heterogeneous arrays use []any; null uses any. Generated fields are exported and preserve their original keys in json tags.

Development

npm install
npm run verify

Use the Run Extension launch configuration to start an Extension Development Host.

The extension uses a dependency-free conversion core, Jest tests, ESLint, and a Vite production bundle. Run npm run verify before publishing.

Output policy

  • A top-level object becomes a named Go struct.
  • A top-level array becomes a named alias to a slice by default.
  • A top-level primitive becomes a named alias to its Go primitive type.
  • Empty arrays use []any, heterogeneous arrays use []any, and null uses any when no more specific context is available.

Support

If you find this extension useful, consider supporting its development by buying me a coffee! Your support helps me continue improving and maintaining the extension.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft