Catalog/data-transform-json-to-go

Data Transform

JSON to Go struct API

Generates a Go struct with json tags from a sample JSON object, exporting CamelCase field names. Answers 'What Go struct matches this JSON?', 'How do I generate a Go struct with json tags from an API response?'.

Price$0.02per request
MethodPOST
Route/v1/data-transform/json-to-go
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
data-transformgogolangstructcodegenjsonwrangle
API URLhttps://x402.hexl.dev/v1/data-transform/json-to-go
Integration docs
Example request
{
  "sample": {
    "user_id": 1,
    "fullName": "x",
    "active": true
  },
  "name": "User"
}
Example response
{
  "go": "type User struct {\n\tUserId int `json:\"user_id\"`\n\tFullName string `json:\"fullName\"`\n\tActive bool `json:\"active\"`\n}"
}
Input schema
{
  "type": "object",
  "required": [
    "sample"
  ],
  "properties": {
    "sample": {
      "type": "object",
      "examples": [
        {
          "user_id": 1,
          "fullName": "x",
          "active": true
        }
      ]
    },
    "name": {
      "type": "string",
      "examples": [
        "User"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}