Compare to json

Built this on top of Dave's code in pull request #8.

This could probably do with refactoring and fleshing out. Thoughts, suggestions?