Jason Connery

no time.

OSX XML and Plist to Json Tips

two quick tips I found useful for developers using OSX this week.

Format XML quicky

You’ve copied a block of unformatted XML from somewhere. Possibly a log output from iOS/Android perhaps. you want to format it to look at it. With the unformatted XML in your clipboard, do:

pbpaste | xmllint --format - | pbcopy

This will replace the unformatted XML with formatted XML in your clipboard. Go ahead and paste it wherever.

Convert a plist to json

I was working with a plist file in an iOS app. I wanted to bundle the same data in android, but didn’t want to be parsing the plist format. seeing as a plist is just describing dictionaries, arrays, etc wouldn’t it be cool to quickly convert a plist into a json representation? turns out that’s pretty simple:

plutil -convert json Countrys.plist -o Countrys.json

and there you have it.