GoLand
 
Get GoLand
You are viewing the documentation for an earlier version of GoLand.

Working with JSON

Last modified: 04 October 2021

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.

https://resources.jetbrains.com/help/img/idea/2023.2/go_converting_json_to_struct.png
Gif

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