34 lines
640 B
Plaintext
34 lines
640 B
Plaintext
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"os"
|
|
|
|
"verint.com/focusedopps/internal/opps"
|
|
)
|
|
|
|
func main() {
|
|
// open json file
|
|
jsonFile, err := os.Open("example.json")
|
|
// if os.Open returns an error then print out it
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
fmt.Println("Successfully Opened complex.json")
|
|
// defer the closing of the json file
|
|
defer jsonFile.Close()
|
|
|
|
byteValue, _ := ioutil.ReadAll(jsonFile)
|
|
var result opps.Result
|
|
err = json.Unmarshal(byteValue, &result)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
fmt.Printf("Opportunities: %+v\n", result.Data.Opportunities)
|
|
fmt.Printf("Next: %+v\n", result.Data.Next)
|
|
|
|
}
|