From the "raw example," resolves references to examples of other data
        types to compute the final example.

        Returns an Example object. The `value` attribute contains a
        JSON-serializable representation of the example.
348086
def _compute_example_flat_helper(self, label):
        
        assert label in self._raw_examples, label

        example = self._raw_examples[label]

        def deref_example_ref(dt, val):
            dt, _ = unwrap_nullable(dt)
            if not dt._has_example(val.label):
                raise InvalidSpec(
                    "Reference to example for '%s' with label '%s' "
                    "does not exist." % (dt.name, val.label),
                    val.lineno, val.path)
            return dt._compute_example(val.label).value

        # Do a deep copy of the example because we're going to mutate it.
        ex_val = OrderedDict()

        def get_json_val(dt, val):
            if isinstance(val, AstExampleRef):
                # Embed references to other examples directly.
                return deref_example_ref(dt, val)
            elif isinstance(val, TagRef):
                return val.union_data_type._compute_example(val.tag_name).value
            elif isinstance(val, list):
                dt, _ = unwrap_nullable(dt)
                return [get_json_val(dt.data_type, v) for v in val]
            elif isinstance(val, dict):
                dt, _ = unwrap_nullable(dt)
                if is_alias(dt):
                    return val
                return {k: get_json_val(dt.value_data_type, v) for (k, v) in val.items()}
            else:
                return val

        for field in self.all_fields:
            if field.name in example.fields:
                example_field = example.fields[field.name]
                if example_field.value is None:
                    # Serialized format doesn't include fields with null.
                    pass
                else:
                    ex_val[field.name] = get_json_val(
                        field.data_type, example_field.value)
            elif field.has_default:
                ex_val[field.name] = get_json_val(
                    field.data_type, field.default)

        return Example(example.label, example.text, ex_val, ast_node=example)
600503
def _parse_value(self, raw):
        
        try:
            if not raw.startswith("0"):
                val = float(raw)
                if (val % 1) == 0:  # integer
                    val = int(raw)
                    return str(val)

                return self.num_format.format(val)
            else:
                raise ValueError("Cannot parse int!")
        except:
            return str(raw)
971970
function (value, modelsToIgnore) {
    modelsToIgnore = modelsToIgnore || {};

    modelsToIgnore[value.name] = value;

    // Response support
    if (value.examples && _.isPlainObject(value.examples) && value.examples['application/json']) {
      value.definition.example = value.examples['application/json'];

      if (_.isString(value.definition.example)) {
        value.definition.example = jsyaml.safeLoad(value.definition.example);
      }
    } else if (!value.definition.example) {
      value.definition.example = value.examples;
    }

    return schemaToJSON(value.definition, value.models, modelsToIgnore, value.modelPropertyMacro);
  }
967622
def get_validated_object(self, value):
        
        try:
            if self.get_field_type().check_value(value) or self.get_field_type().can_use_value(value):
                data = self.get_field_type().use_value(value)
                self._prepare_child(data)
                return data
            else:
                return None
        except AttributeError:
            return value
1130163
def from_raw(self, rval: RawValue, jptr: JSONPointer = "") -> Value:
        """"""
        def convert(val):
            if isinstance(val, list):
                res = ArrayValue([convert(x) for x in val])
            elif isinstance(val, dict):
                res = ObjectValue({x: convert(val[x]) for x in val})
            else:
                res = val
            return res
        return convert(rval)
1005156
def __type2js(cls, value):
        
        if value is None:
            return 'null'
        elif isinstance(value, bool):
            return 'false' if not value else 'true'
        elif isinstance(value, (int, float)):
            return '%s' % value
        elif isinstance(value, dict):
            return json.dumps(dict)
        return '"%s"' % value
1264475
function (value, modelsToIgnore) {
    modelsToIgnore = modelsToIgnore || {};

    modelsToIgnore[value.name] = value;

    // Response support
    if (value.examples && _.isPlainObject(value.examples)) {
      value = _.cloneDeep(value);
      var keys = Object.keys(value.examples);

      _.forEach(keys, function(key) {
        if(key.indexOf('application/json') === 0) {
          var example = value.examples[key];
          if (_.isString(example)) {
            example = jsyaml.safeLoad(example);
          }
          value.definition.example = example;
          return schemaToJSON(value.definition, example, modelsToIgnore, value.modelPropertyMacro);
        }
      });
    }

    if (value.examples) {
      value = _.cloneDeep(value);
      var example = value.examples;
      if (_.isString(example)) {
        example = jsyaml.safeLoad(example);
      }
      value.definition.example = example;
      return schemaToJSON(value.definition, example, modelsToIgnore, value.modelPropertyMacro);
    }

    return schemaToJSON(value.definition, value.models, modelsToIgnore, value.modelPropertyMacro);
  }
217905
def parse_value_object(self, tup_tree):
        

        self.check_node(tup_tree, 'VALUE.OBJECT')

        child = self.one_child(tup_tree, ('CLASS', 'INSTANCE'))

        return (name(tup_tree), attrs(tup_tree), child)
1066155
private Object convertObjectToSingleValue(Object rawValue, ExtendedAttributeDefinition attrDef, EvaluationContext context, int index,
                                              boolean ignoreWarnings) throws ConfigEvaluatorException {
        if (rawValue instanceof String) {
            return convertStringToSingleValue((String) rawValue, attrDef, context, ignoreWarnings);
        } else if (rawValue instanceof ConfigElement.Reference) {
            ConfigElement.Reference reference = processReference((ConfigElement.Reference) rawValue, context, ignoreWarnings);
            if (attrDef != null && attrDef.getType() == MetaTypeFactory.PID_TYPE) {
                return evaluateReference(reference.getId(), attrDef, context);
            } else {
                return evaluateReference(reference, context);
            }
        } else if (rawValue instanceof ConfigElement) {
            return convertConfigElementToSingleValue((ConfigElement) rawValue, attrDef, context, index, ignoreWarnings);
        } else {
            throw new IllegalStateException("Unsupported type: " + rawValue.getClass());
        }
    }
965949
def serialize(self, value, **kwargs):
        
        if self._serialize is not None:
            return self._serialize(value, **kwargs)
        else:
            return value
1307043
def get_response_example(cls, operation, response):
        
        path = "#/paths/'{}'/{}/responses/{}".format(
            operation.path, operation.method, response.name)
        kwargs = dict(paths=[path])

        if response.type in PRIMITIVE_TYPES:
            result = cls.get_example_value_for_primitive_type(
                response.type, response.properties, response.type_format, **kwargs)
        else:
            schema = SchemaObjects.get(response.type)
            result = cls.get_example_by_schema(schema, **kwargs)

        return result
1209281
def make_value_from_datastore(self, value):
    

    if value is None:
      return None
    _json = json.loads(value, cls=JsonDecoder)
    if self.data_type == dict:
      return _json
    return self.data_type.from_json(_json)
837822
def dumps(self, value):
    ''''''
    for serializer in self:
      value = serializer.dumps(value)
    return value
434371
async def serialize(self, value, native=False):
        '''
        
        '''
        if native:
            return self.to_python(value)
        return self.to_data(value)
525698
def _serialize_value(self, value):
        
        if isinstance(value, (list, tuple, set)):
            return [self._serialize_value(v) for v in value]
        elif isinstance(value, dict):
            return dict([(k, self._serialize_value(v)) for k, v in value.items()])
        elif isinstance(value, ModelBase):
            return value._serialize()
        elif isinstance(value, datetime.date):  # includes datetime.datetime
            return value.isoformat()
        else:
            return value
720662
def get_value_for_datastore(self, model_instance):
    
    value = super(JsonProperty, self).get_value_for_datastore(model_instance)
    if not value:
      return None
    json_value = value
    if not isinstance(value, dict):
      json_value = value.to_json()
    if not json_value:
      return None
    return datastore_types.Text(json.dumps(
        json_value, sort_keys=True, cls=JsonEncoder))
107116
def _converter(self, value):
        
        if type(value) is not self.related_model_cls.Collection:
            value = self.related_model_cls.Collection([
                self._get_model_instance(self.related_model_cls, item)
                for item in value])
        return value