Start a project

Tool 246 of 425 · Go

JSON to Go Struct

Generates idiomatic Go structs with correct json tags from sample JSON.

JSON to Go Struct

Your input

Result

Go

    01

    What it does

    Generates idiomatic Go structs with correct json tags from sample JSON.

    • json tags with omitempty
    • Go initialisms (ID, URL, HTTP)
    • Nested named or inline structs
    • time.Time for timestamps

    02

    Private by design

    Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

    03

    What you get

    Go source, with a Copy and a Download button on every result.

    • Go
    • Struct
    • JSON

    Why it matters

    Go needs a struct for every JSON shape, and tags, initialisms and number types are tedious to get right by hand.

    Paste a response and get a package you can drop in.

    How to use it

    1. Type or paste your input; the example shows the format.
    2. Press Generate Go. Results also update as you type.
    3. Read the summary line, then the table, notes or output below it.
    4. Copy or download what you need. Nothing leaves this page.

    FAQ

    Why float64 for some numbers?

    Numbers with decimals become float64; whole numbers become int64.

    What about null values?

    They become pointers or interface{}, since the sample can't show the type.

    Is my input uploaded?

    No. The tool runs in your browser and nothing you type, paste or open is sent anywhere.

    Can I rely on the result?

    It follows the public specification or formula named on this page and says where it simplifies. Check anything critical against the official tool or documentation before you ship it.

    Work with me

    Want a site that gets these right?

    I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

    All developer tools · Back to leej.uk