I would use `if kwargs.get('json', None):` here. It will make sure that json is not None and is not an empty string