When I use ordinary values, for example, a string, the printout works well for me when executing the GET method through POSTMAN. When I want the values in the database to be NULL, and instead of string I use sql.NullString, when executing the GET method in POSTMAN, I get the array of empty objects in JSON format.
While when printing the array in the for loop, the printout is as follows:
{id:1 name:{String:Analytical DBs Valid:true} description:{String: Valid:false} url_icon:{String: Valid:false} url_description:{String: Valid:false}}
{id:2 name:{String:Message brokers Valid:true} description:{String: Valid:false} url_icon:{String: Valid:false} url_description:{String: Valid:false}}
{id:3 name:{String:Data visualisation Valid:true} description:{String: Valid:false} url_icon:{String: Valid:false} url_description:{String: Valid:false}}
{id:4 name:{String:Time series DBs Valid:true} description:{String: Valid:false} url_icon:{String: Valid:false} url_description:{String: Valid:false}}
{id:5 name:{String:Custom apps Valid:true} description:{String: Valid:false} url_icon:{String: Valid:false} url_description:{String: Valid:false}}
{id:6 name:{String:AI/ML modules Valid:true} description:{String: Valid:false} url_icon:{String: Valid:false} url_description:{String: Valid:false}}
I don't know why it doesn't print these structures as JSON regardless of the type..
To print the array, I use the method:
c.IndentedJSON(http.StatusOK, categories)