lesson24

command
v0.0.0-...-8eea285 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Experiment: marshal.go Write a program that outputs coordinates in JSON format, expanding on work done for the preceding quick check. The JSON output should provide each coordinate in decimal degrees (DD) as well as the degrees, minutes, seconds format:

{
	"decimal": 135.9,
	"dms": "135°54'0.0\" E",
	"degrees": 135,
	"minutes": 54,
	"seconds": 0,
	"hemisphere": "E"
}

This can be achieved without modifying the coordinate structure by satisfying the json.Marshaler interface to customize the JSON. The MarshalJSON method you write may make use of json.Marshal. NOTE To calculate decimal degrees, you’ll need the decimal method introduced in lesson 22.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL