# Introduce type

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/go/2026.3/llms.txt).

The Introduce Type refactoring creates a named type from a type expression, such as an anonymous struct type.

For example, consider the following JSON:

```JSON
{
"email": "noah.poulsen@example.com",
"gender": "male",
"phone_number": "53705244",
"birthdate": 1314124015,
"location": {
    "street": "7998 oddenvej",
    "city": "nr åby",
    "state": "syddanmark",
    "postcode": 73617
},
"username": "purplesnake503",
"password": "zelda",
"first_name": "noah",
"last_name": "poulsen",
"title": "mr",
"picture": "men/41.jpg"
}
```

Paste the JSON into the editor and convert it to a struct type. The resulting `T` struct has a named `Location` field with an anonymous struct type. Use the refactoring to extract that anonymous type into a named type. The field remains a named field; this does not embed a type.

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/go_extract_type_refactoring.mp4)

Procedure:

1. In the editor, click a type that you want to extract.

2. Click `Refactor | Extract/Introduce` and select  Introduce Type.

The animation shows how GoLand converts the anonymous structure type to a named type. You can try the Introduce Type refactoring with the following code snippet.

```GO
package main

func main() {
	_ = struct {
		Field1 string
		Field2 int
	}{
		Field1: "Hello",
		Field2: 42,
	}
}
```

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/go_anonymous_structure_type_to_named_type.mp4)

