Skip to content

Json To Go Struct API

POST https://api.findutils.com/api/tools/json-to-go-struct/execute

Returns Go struct definitions (as source text) generated from a JSON object. Field names become PascalCase, nested objects become their own structs (or inline structs), and json tags with optional omitempty are added.

Request body

application/json
  • json

    string required

    A JSON object (text). The top-level value must be an object.

  • struct_name

    string optional

    Name of the top-level struct. Default: "Root". Default "Root".

  • add_json_tags

    boolean optional

    Add `json:"..."` struct tags. Default: true. Default true.

  • omit_empty

    boolean optional

    Append ",omitempty" to every json tag. Default: false. Default false.

  • inline_structs

    boolean optional

    Emit nested objects as inline anonymous structs instead of named types. Default: false. Default false.

Example arguments

Verified
{
  "json": {
    "user_name": "a",
    "age": 3,
    "address": {
      "city": "x"
    }
  }
}