Transforms an json object to an entity
963812
public function reverseTransform($properties) {
    if (!is_array($properties)) {
      return NULL;
    }

    if (!isset($properties[$this->identifierName])) {
      throw new TransformationFailedException(sprintf(
        'Identifier (%s) for entity %s is not set in properties %s',
        $this->identifierName,
        $this->entityClass,
        json_encode($properties, JSON_PRETTY_PRINT)
      ));
    }

    $identifier = $properties[$this->identifierName];

    $entity = $this->om
      ->getRepository($this->entityClass)
      ->findOneBy(array($this->identifierName => $identifier))
    ;

    if (!($entity instanceof $this->entityClass)) {
      throw new TransformationFailedException(sprintf(
        'Entity %s with identifier (%s) "%s" cannot be found',
        $this->entityClass,
        $this->identifierName,
        $identifier
      ));
    }

    return $entity;
  }
681337
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'entities' in _dict:
            args['entities'] = [
                QueryEntitiesEntity._from_dict(x)
                for x in (_dict.get('entities'))
            ]
        return cls(**args)
90071
def transform_jsonld(self, obj):
        """"""
        rec = copy.deepcopy(obj)
        rec.update(self.context)
        compacted = jsonld.compact(rec, self.context)
        if not self.expanded:
            return compacted
        else:
            return jsonld.expand(compacted)[0]
489546
def element_to_objects(payload: Dict) -> List:
    
    entities = []
    cls = MAPPINGS.get(payload.get('type'))
    if not cls:
        return []

    transformed = transform_attributes(payload, cls)
    entity = cls(**transformed)

    if hasattr(entity, "post_receive"):
        entity.post_receive()

    entities.append(entity)

    return entities
151748
def _fromJSON(cls, jsonobject):
        
        newInstance = cls(jsonobject[0], jsonobject[1])
        for arrayType, jsonEntry in viewitems(jsonobject[2]):
            arrayEntry = {'dataProcessingRef': jsonEntry['dataProcessingRef'],
                          'params': [tuple(_) for _ in jsonEntry['params']]
                          }
            newInstance.arrayInfo[arrayType] = arrayEntry

        return newInstance
185340
function JSONCookies (obj) {
  var cookies = Object.keys(obj)
  var key
  var val

  for (var i = 0; i < cookies.length; i++) {
    key = cookies[i]
    val = JSONCookie(obj[key])

    if (val) {
      obj[key] = val
    }
  }

  return obj
}
431923
def to_json(value, **kwargs):
        """"""
        if isinstance(value, HasProperties):
            return value.serialize(**kwargs)
        try:
            return json.loads(json.dumps(value))
        except TypeError:
            raise TypeError(
                "Cannot convert type {} to JSON without calling 'serialize' "
                "on an instance of Instance Property and registering a custom "
                "serializer".format(value.__class__.__name__)
            )
1272867
def extract_entity(found):
    """"""
    obj = dict()
    for prop in found.entity.property:
        obj[prop.name] = prop.value.string_value
    return obj
522519
function serializeObject(obj) {
  var seen = [];

  return JSON.stringify(obj, function(key, val) {
    val = toJsonReplacer(key, val);
    if (isObject(val)) {

      if (seen.indexOf(val) >= 0) return '...';

      seen.push(val);
    }
    return val;
  });
}
1009619
def to_dict(self):
        
        entity_dict = {}

        for field, val in six.iteritems(self._fields):
            if field.multiple:
                if val:
                    val = [_dictify(field, x) for x in val]
                else:
                    val = []
            else:
                val = _dictify(field, val)

            # Only add non-None objects or non-empty lists
            if val is not None and val != []:
                entity_dict[field.key_name] = val

        self._finalize_dict(entity_dict)

        return entity_dict
1311001
function toJSON(key) {
    var O = toObject(this);
    var pv = toPrimitive(O);
    return typeof pv == 'number' && !isFinite(pv) ? null :
      (!('toISOString' in O) && classof(O) == 'Date') ? toISOString.call(O) : O.toISOString();
  }
515062
function jsonReplacer(key, value) {
  if (value && (value.DAO || value.sequelize)) {
    return value.name || '';
  }
  return value;
}
1252489
private static JsonObject getJsonObject(Set<Attribute> columns, Object object)
    {
        JsonObject jsonObject = new JsonObject();
        for (Attribute column : columns)
        {
            if (!column.isAssociation())
            {
                Object valueObject = PropertyAccessorHelper.getObject(object, (Field) column.getJavaMember());
                jsonObject.add(((AbstractAttribute) column).getJPAColumnName(),
                        getJsonPrimitive(valueObject, column.getJavaType()));
            }
        }
        return jsonObject;
    }
1374454
private static function transformObject(\stdClass $json, $class, $callback)
    {
        if (is_string($class)) {
            $object = new $class();
        } else {
            $object = $class;
        }

        foreach (static::getPropertyMapping($object) as $destination => $source) {
            static::map($json, $source, $object, $destination);
        }

        if ($callback) {
            call_user_func_array($callback, array($object));
        }

        return $object;
    }
245503
def object_to_json(obj):
    """"""
    if isinstance(obj, (datetime.datetime, datetime.date, datetime.time)):
        return obj.isoformat()
    return str(obj)
496425
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'input' in _dict:
            args['input'] = MessageInput._from_dict(_dict.get('input'))
        if 'intents' in _dict:
            args['intents'] = [
                RuntimeIntent._from_dict(x) for x in (_dict.get('intents'))
            ]
        if 'entities' in _dict:
            args['entities'] = [
                RuntimeEntity._from_dict(x) for x in (_dict.get('entities'))
            ]
        return cls(**args)
792280
function serialize(object) {
	function replacer(key, value) {
		if (typeof value === 'string' && value.match(ISO8601_DATE_REGEX)) {
			value = new Date(value);
			value = value.toISOString();
		}
		return value;
	}

	return JSON.stringify(object, replacer);
}