'Converts a data field from JSON into an element
@param key: key (field name)
@param value: value for the field
@param native: use native mode
@type native: bool'

@classmethod
def __json2element(cls, key, value, native=False):

    if isinstance(value, dict):
        element = cls.__obj2element(key, value, native=native)
    elif isinstance(value, (list, tuple)):
        if (key != cls.TAG.item):
            element = etree.Element(key)
        else:
            element = etree.Element(cls.TAG.list)
        json2element = cls.__json2element
        item_tag = cls.TAG.item
        for obj in value:
            item = json2element(item_tag, obj, native=native)
            element.append(item)
    else:
        if native:
            element = etree.Element(cls.TAG.data)
            element.set(cls.ATTRIBUTE.field, key)
        else:
            element = etree.Element(key)
        if (not isinstance(value, basestring)):
            value = str(value)
        element.text = value
    return element
