# Working with JSON

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

JavaScript Object Notation (JSON) is a textual format in which you can represent, store, and transfer structural data.

In Go, `map` and `struct` data types provide the closest JSON representation as they can store data in a `key:value` format.

When you paste JSON in GoLand, the IDE suggests converting it to the `struct` type. All the necessary `struct` field tags are generated and added automatically.

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

You can use the copy-and-paste approach or the Generate Go Type from JSON dialog.

## Intention actions

By using intention actions, you can add new tags, keys and modify the code style of tag keys.

Procedure: Add new tags to a struct field

1. Click a struct field and press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Ctrl+.` (VSCode), `⌘ .` (VSCode (macOS)).

2. Select Add key to tags.

Procedure: Modify keys in field tags

1. Click a struct field and press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Ctrl+.` (VSCode), `⌘ .` (VSCode (macOS)).

2. Select Update key value in tags.

Procedure: Change code style of tag keys

1. Click a key in tag and press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Ctrl+.` (VSCode), `⌘ .` (VSCode (macOS)).

2. Select Change field name style in tags.

## Code completion

When you modify tag keys, GoLand displays a list of the most popular values for these tags. For example, `json` suggests `omitempty`; `xml` has `attr`, `cdata`, `chardata`, `innerxml`, and others; `asn1` has `optional`, `explicit`, `generalized`, and so on.

Procedure: Style for struct tags

* When you start filling out a tag, right after you type backticks (```), GoLand will suggest entering a key. Press `Tab` (Windows), `⇥` (macOS), `⇥` (IntelliJ IDEA Classic (macOS)), `⇥` (macOS System Shortcuts), `Tab` (XWin), `Tab` (GNOME), `Tab` (KDE), `Tab` (Emacs), `Tab` (Sublime Text), `⇥` (Sublime Text (macOS)), `Tab` (VSCode), `⇥` (VSCode (macOS)) or `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (VSCode), `⏎` (VSCode (macOS)) and you will see a list of options. Choose the style of the value name. The IDE saves your choice, and it will suggest the same style first in the list for other fields of this struct.

## Tips and tricks

Procedure: Generate fields for an empty struct

If you have an empty `struct`, you can generate all the necessary fields and tags from JSON. To do that, call the Generate Go Type from JSON dialog by using the Go to Action search and paste your JSON in the text field. Alternatively, you can navigate to `Code | Generate…` and select Type from JSON in the popup window.

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

