Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>struct-to-json-generatorNew to Visual Studio Code? Get it now.
struct-to-json-generator

struct-to-json-generator

Olorunmitobiloba

|
181 installs
| (0) | Free
Generate JSON from Go structs
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Struct to JSON Generator

This Visual Studio Code extension converts Go structs to JSON format with realistic fake data, offering a powerful tool for testing and development.

Features

  • Converts selected Go struct to JSON with fake data
  • Generates multiple JSON objects based on the same struct
  • Supports nested structs and various Go types including slices
  • Intelligently generates fake data based on field names (e.g., email, name, ID)
  • Copies the generated JSON to clipboard
  • Offers pretty-printing of JSON output
  • Customizable number of JSON objects to generate

Requirements

  • Visual Studio Code 1.6.0 or higher
  • Go must be installed on your system

Installation

  1. Open Visual Studio Code
  2. Press Ctrl+P (or Cmd+P on macOS) to open the Quick Open dialog
  3. Type ext install your-publisher-name.struct-to-json-generator and press Enter

Usage

  1. Open a Go file containing the struct you want to convert
  2. Select the entire struct in your editor
  3. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on macOS)
  4. Type "Generate JSON from Struct" and select the command
  5. The generated JSON will be copied to your clipboard and a notification will appear

Supported Types

The extension supports the following Go types:

  • Basic types: string, int, int32, int64, bool, float64
  • Time: time.Time
  • Custom types: decimal.Decimal
  • Slices of supported types
  • Nested structs

Fake Data Generation

The extension generates realistic fake data based on field names:

  • Fields containing "id" generate UUIDs
  • Fields containing "name" generate full names
  • Fields containing "email" generate email addresses
  • Fields containing "country" generate country names
  • Fields containing "currency" generate currency codes
  • Fields containing "datetime" generate RFC3339 formatted dates
  • Fields containing "status" generate random statuses
  • Fields containing "password" generate secure passwords

Other string fields generate sentences, and numeric fields generate random numbers within a reasonable range.

Known Issues

Please report any issues on the GitHub repository.

Release Notes

0.0.1

Initial release of Struct to JSON Generator


For more information

  • Visual Studio Code's Markdown Support
  • Markdown Syntax Reference

Enjoy!

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