The problem that go returns json

When

go returns a json string, is it true that only fields with uppercase or all uppercase letters in the structure will be returned?

    type User struct {
        Id   int
        Name string
        sex string
    }
    me := User{Id: 12, Name: "",sex: ""}
    //json
    this.Data["json"] = &me
    this.ServeJSON()

the lowercase sex here will not be returned. Is this a characteristic of go?

{
Id: 12,
Name: ""
}
Dec.31,2021

Yes, the go language states that only identifiers that begin with uppercase letters are export. So other modules cannot access private variables in this structure


Yes, go starts with uppercase and lowercase letters to distinguish between public and private. If you convert lowercase to json, you can go like this:

type User struct {
        Id   int `json:"id"`
        Name string `json:"name"`
        Sex string `json:"sex"`
    }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3651f-2b780.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3651f-2b780.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?