Refactoring of json cookbook functions.