Refactored out some common code in json production.
Merge branch 'dev' of github.com:intermine/intermine into dev