Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 1.02 KB

README.md

File metadata and controls

39 lines (30 loc) · 1.02 KB

plist

Plist parses macOS *.plist input data and formats them as JSON.

NOTE: Currently only supports XML based plists, not the binary format.

Getting started

Try out plist with a small program like this:

package main

import "github.com/johnstarich/go/plist"

func main() {
    myPlistContents := `
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Greeting</key>
    <string>Hello world!</string>
</dict>
`
    reader := strings.NewReader(myPlistContents)
    jsonBytes, _ := plist.ToJSON(reader)

    var myPList MyPList
    _ = json.Unmarshal(jsonBytes, &myPList)
    fmt.Println(myPList)
    // Output: {Hello world!}
}

type MyPList struct {
    Greeting string
}

Thoughts or questions? Please open an issue to discuss.