1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package main
- import (
- "fmt"
- "git.red-green.com/david/astruct"
- )
- func main() {
- var a *astruct.Astruct = astruct.NewAstruct("Weather")
- var err error = a.ReadFile("test.json")
- if err != nil {
- fmt.Println("Err:", err)
- return
- }
- fmt.Println("MapLikes:")
- for name, m := range a.MapLikes {
- if name == "" {
- continue
- }
- fmt.Printf("%s\n", name)
- for k, v := range m {
- fmt.Printf(" '%s' = %s\n", k, v.String())
- }
- }
- fmt.Println("ArrayLikes:")
- for name, a := range a.ArrayLikes {
- if name == "" {
- continue
- }
- fmt.Printf("%s\n", name)
- for i, v := range a {
- fmt.Printf(" %d = %s\n", i, v.String())
- }
- }
- err = a.WriteFile("output.txt", "test", 0666)
- if err != nil {
- fmt.Println("Err:", err)
- return
- }
- }
|