In Go, to encode a data structure into JSON, the fields in the data structure need to be exported, meaning they need to start with a _____ letter.

  • lowercase
  • uppercase
  • capital
  • special
The correct answer is uppercase. In Go, when you encode a data structure into JSON using the encoding/json package, the fields in the data structure need to be exported, which means they need to start with an uppercase letter. Exported fields are those that are accessible from outside the package, and they are the only fields that the encoding/json package can encode into JSON. This convention is important for proper JSON encoding and decoding in Go.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *