blob: 91963369f2c247b1af17b7ebb01a92b3bab6123f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package main
import (
"encoding/json"
"fmt"
"os"
"vparse"
)
func check(err error) {
if err != nil {
panic(err)
}
}
func vToJson(filename string) string {
f, err := os.Open(filename)
check(err)
parsed := vparse.Parse(f)
jsonEncoded, err := json.MarshalIndent(parsed, "", "\t")
check(err)
return string(jsonEncoded)
}
func main() {
fmt.Println(vToJson("vcal.ics"))
fmt.Println(vToJson("vcard.vcs"))
}
|