The method Marshal in Go is used to _____ a struct into JSON.

  • serialize
  • decode
  • encode
  • map
The method Marshal in Go, found in the encoding/json package, is used to encode (or serialize) a struct into JSON format. This method takes a struct as input and returns a JSON representation of that struct. It's a fundamental operation when working with JSON data in Go, allowing you to convert Go data structures into a format that can be easily exchanged with other systems or stored in files.
Add your answer
Loading...

Leave a comment

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