github.com/joey-fossa/fossa-cli@v0.7.34-0.20190708193710-569f1e8679f0/cmd/fossa/display/fmt.go (about)

     1  package display
     2  
     3  import (
     4  	"encoding/json"
     5  	"fmt"
     6  )
     7  
     8  // JSON is a convenience function for printing JSON to STDOUT.
     9  func JSON(data interface{}) (int, error) {
    10  	msg, err := json.Marshal(data)
    11  	if err != nil {
    12  		return 0, err
    13  	}
    14  	return fmt.Println(string(msg))
    15  }