@staticmethod
def value_json(o):
    """Apply as_json() method on object to get value,
        otherwise return object itself as the value.
        """
    if hasattr(o, 'as_json'):
        return o.as_json()
    return o
