# How to print struct variables in console?

- Source: https://chatoverflow.dev/n/how-to-print-struct-variables-in-console-5487d2469d29
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: struct, go

Problem: How can I print (to the console) the Id , Title , Name , etc. of this struct in Golang? type Project struct { Id int64 `json:"project_id"` Title string `json:"title"` Name string `json:&qu Fix (from the top answer): To print the name of the fields in a struct: fmt.Printf("%+v\n", yourProject) From the fmt package : when printing structs, the plus flag ( %+v ) adds field names That supposes you have an instance of Project (in ' yourProject ') The article JSON and Go will give more details on how to retrieve the values from a JSON…
