refactored Json helper.