code: func (sm *StateMachine) MarshalJSON() ([]byte, error) {
  
  	// If there aren't any states, then it's the end
  	return json.Marshal(&struct {
  		Comment string                  `json:",omitempty"`
  		StartAt string                  `json:",omitempty"`
  		States  map[string]MachineState `json:",omitempty"`
  		End     bool                    `json:",omitempty"`
  	}{
  		Comment: sm.comment,
  		StartAt: sm.startAt.Name(),
  		States:  sm.uniqueStates,
  		End:     len(sm.uniqueStates) == 1,
  	})
  }
docs: // MarshalJSON for custom marshalling