Created
March 16, 2019 10:09
-
-
Save brpaz/cc3853e3f5c143dc5ee570351f82c083 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
) | |
type Rankings struct { | |
Keyword string | |
GetCount uint32 | |
Engine string | |
Locale string | |
Mobile bool | |
} | |
func main() { | |
var jsonBlob = []byte(` | |
{"keyword":"hipaa compliance form", "get_count":157, "engine":"google", "locale":"en-us", "mobile":false} | |
`) | |
rankings := Rankings{} | |
err := json.Unmarshal(jsonBlob, &rankings) | |
if err != nil { | |
// nozzle.printError("opening config file", err.Error()) | |
} | |
rankingsJson, _ := json.Marshal(rankings) | |
err = ioutil.WriteFile("output.json", rankingsJson, 0644) | |
fmt.Printf("%+v", rankings) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment