Initial refactoring of nomlib's JSON API from feature/JSON