Compare to json

Built this on top of Dave's code in pull request #8.

This could probably do with refactoring and fleshing out. Any thoughts or suggestions before I go more down this path?