daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Mar 21st, 2019 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main
  2.  
  3. import (
  4.     "encoding/json"
  5.     "fmt"
  6.     "io/ioutil"
  7. )
  8.  
  9. type Rankings struct {
  10.     Keyword  string
  11.     GetCount uint32
  12.     Engine   string
  13.     Locale   string
  14.     Mobile   bool  
  15. }
  16.  
  17. func main() {
  18.     var jsonBlob = []byte(`
  19.         {"keyword":"hipaa compliance form", "get_count":157, "engine":"google", "locale":"en-us", "mobile":false}
  20.     `)
  21.     rankings := Rankings{}
  22.     err := json.Unmarshal(jsonBlob, &rankings)
  23.     if err != nil {
  24.         // nozzle.printError("opening config file", err.Error())
  25.     }
  26.  
  27.     rankingsJson, _ := json.Marshal(rankings)
  28.     err = ioutil.WriteFile("output.json", rankingsJson, 0644)
  29.     fmt.Printf("%+v", rankings)
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top