← Back
Editing: json_util.cpython-38.pyc
U ��]�= � @ s� d Z ddlZddlZddlZddlZddlZddlmZmZm Z m Z e�e�Z G dd� de�ZG dd� dej�Ze�e�G dd � d e je j��Zd d� Zdd d�Zdd� Zddd�Zdd� Zdd� Zdd� Zdd� ZG dd� de�ZdS )z�JSON (de)serialization framework. The framework presented here is somewhat based on `Go's "json" package`_ (especially the ``omitempty`` functionality). .. _`Go's "json" package`: http://golang.org/pkg/encoding/json/ � N)�b64�errors� interfaces�utilc @ sr e Zd ZdZdZddd�Zedd� �Zd d � Zdd� Z d d� Z dd� Zdd� Zdd� Z edd� �Zedd� �ZdS )�Fielda� JSON object field. :class:`Field` is meant to be used together with :class:`JSONObjectWithFields`. ``encoder`` (``decoder``) is a callable that accepts a single parameter, i.e. a value to be encoded (decoded), and returns the serialized (deserialized) value. In case of errors it should raise :class:`~josepy.errors.SerializationError` (:class:`~josepy.errors.DeserializationError`). Note, that ``decoder`` should perform partial serialization only. :ivar str json_name: Name of the field when encoded to JSON. :ivar default: Default value (used when not present in JSON object). :ivar bool omitempty: If ``True`` and the field value is empty, then it will not be included in the serialized JSON object, and ``default`` will be used for deserialization. Otherwise, if ``False``, field is considered as required, value will always be included in the serialized JSON objected, and it must also be present when deserializing. )� json_name�default� omitempty�fdec�fencNFc C s>