'Validator method, converts the JSON returned from the input
field into a Python object.
@param value: the JSON from the input field.
@return: tuple of (value, error), where value is the converted
JSON, and error the error message if the decoding
fails, otherwise None'

def parse(self, value):

    if isinstance(value, basestring):
        try:
            value = json.loads(value)
        except:
            import sys
            error = sys.exc_info()[1]
            if hasattr(error, 'message'):
                error = error.message
        else:
            error = None
    else:
        value = None
        error = None
    return (value, error)
