APIMethod: write
Write a context document given a map.

Parameters:
obj - {<OpenLayers.Map> | Object} A map or context object.
options - {Object} Optional configuration object.

Returns:
{String} A context document string.
331245
function(obj, options) {
        obj = this.toContext(obj);
        return OpenLayers.Format.XML.VersionedOGC.prototype.write.apply(this,
            arguments);
    }
49649
public static Object write(Context cx, Scriptable thisObj,
                               Object[] args, Function funObj)
    {
        return doPrint(args, funObj, false);
    }
779154
function(context, options) {
        var name = "OWSContext";
        this.nestingLayerLookup = {}; //start with empty lookup
        options = options || {};
        OpenLayers.Util.applyDefaults(options, context);
        var root = this.writeNode(name, options);
        this.nestingLayerLookup = null; //clear lookup
        this.setAttributeNS(
            root, this.namespaces["xsi"],
            "xsi:schemaLocation", this.schemaLocation
        );
        return OpenLayers.Format.XML.prototype.write.apply(this, [root]);
    }
1041307
public static boolean writeObjectToFile(Object obj, File f) {
        try {
            FileOutputStream fout = new FileOutputStream(f);
            ObjectOutputStream oos = new ObjectOutputStream(fout);
            oos.writeObject(obj);
            oos.close();
        } catch (Exception e) {
            System.out.println("Error writing Object to file: "
                    + e.getMessage());
            return false;
        }
        return true;
    }
609917
public static String serialize(Object obj) throws ApiException {
        try {
            if (obj != null)
                    if (obj instanceof String) {
                        // This assumes that we receive json as a string
                        return (String) obj;
                } else {
                        return JsonUtil.getJsonMapper().writeValueAsString(obj);
                }
            else
                return null;
        }
        catch (Exception e) {
            throw new ApiException(500, e.getMessage());
        }
    }
109755
public static String toJson(Object obj) {
        StringWriter sw = new StringWriter();
        ObjectMapper mapper = getDefaultObjectMapper();
        try {
            JsonGenerator jg = mapper.getFactory().createGenerator(sw);
            mapper.writeValue(jg, obj);
        } catch (JsonMappingException e) {
            e.printStackTrace();
        } catch (JsonGenerationException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return sw.toString();
    }
254433
async function write(filename, object, options = undefined) {
  const {encoding, flag, ...opts} = normalizeOptions(options)

  if (!isNumber(filename)) {
    filename = toAbsolute(base, filename)

    opts.filename = filename
  }

  await fs.writeFile(filename, yaml.dump(object, opts), {encoding, flag})
}
908601
@SuppressWarnings("all")
    protected static boolean writeObjectType(Output out, Object obj) {
        if (obj instanceof ObjectMap || obj instanceof BeanMap) {
            out.writeObject((Map) obj);
        } else if (obj instanceof Map) {
            out.writeMap((Map) obj);
        } else if (obj instanceof RecordSet) {
            out.writeRecordSet((RecordSet) obj);
        } else {
            out.writeObject(obj);
        }
        return true;
    }
1013328
function stringify(obj) {
  if (!isObject(obj)) {
    throw new Error('`Stringify`\'s first argument should be an object')
  }

  var meta = Object.keys(obj)
    .map(function (key) {
      return getLine(key, obj[key])
    }).join('')

  return '// ==UserScript==\n' + meta + '// ==/UserScript==\n'
}
405638
function(obj) {
        if (obj == null) {
            obj = new OpenLayers.Layer.Bing(this.options);
        }
        //get all additions from superclasses
        obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
        // copy/set any non-init, non-simple values here
        return obj;
    }
574648
def write_object( object )
      obj_written = write_object_variables(object)
      log.debug "instances=#{object.get_instance_variables.inspect} mem_len=0x#{object.padded_length.to_s(16)}"
      indexed_written = write_object_indexed(object)
      log.debug "type #{obj_written} , total #{obj_written + indexed_written} (array #{indexed_written})"
      log.debug "Len = 0x#{object.get_length.to_s(16)} , inst =0x#{object.get_type.instance_length.to_s(16)}" if object.is_a? Parfait::Type
      pad_after( obj_written + indexed_written  )
      Position.get(object)
    end
1136846
function overwrite(obj, defaults) {
  var res = {};
  var dFlat = collapse(defaults);
  var oFlat = collapse(obj);
  for (var key in dFlat) {
    val(res, key, dFlat[key]);
  }
  for (var key in oFlat) {
    val(res, key, oFlat[key]);
  }
  return res;
}
130887
def serialize(obj, **options):
    '''
    
    '''

    try:
        if 'file_out' in options:
            return toml.dump(obj, options['file_out'], **options)
        else:
            return toml.dumps(obj, **options)
    except Exception as error:
        raise SerializationError(error)
814940
def writeObject(self, o):
        
        if self.writeReference(o) != -1:
            return

        self.context.addObject(o)
        alias = self.context.getClassAlias(o.__class__)

        alias.compile()

        if alias.amf3:
            self.writeAMF3(o)

            return

        if alias.anonymous:
            self.writeType(TYPE_OBJECT)
        else:
            self.writeType(TYPE_TYPEDOBJECT)
            self.serialiseString(alias.alias)

        attrs = alias.getEncodableAttributes(o, codec=self)

        if alias.static_attrs and attrs:
            for key in alias.static_attrs:
                value = attrs.pop(key)

                self.serialiseString(key)
                self.writeElement(value)

        if attrs:
            self._writeDict(attrs)

        self._writeEndObject()
1168357
public JsonWriter write(Object object) throws IOException {
        if (object == null) {
            writeNull();
        } else if (object instanceof String
                || object instanceof Date) {
            writeValue(object.toString());
        } else if (object instanceof Boolean) {
            writeValue((Boolean)object);
        } else if (object instanceof Number) {
            writeValue((Number)object);
        } else if (object instanceof Parameters) {
            openCurlyBracket();

            Map<String, ParameterValue> params = ((Parameters)object).getParameterValueMap();
            Iterator<ParameterValue> it = params.values().iterator();
            while (it.hasNext()) {
                Parameter p = it.next();
                String name = p.getName();
                Object value = p.getValue();
                checkCircularReference(object, value);

                writeName(name);
                write(value);
                if (it.hasNext()) {
                    writeComma();
                }
            }

            closeCurlyBracket();
        } else if (object instanceof Map<?, ?>) {
            openCurlyBracket();

            @SuppressWarnings("unchecked")
            Iterator<Map.Entry<Object, Object>> it = ((Map<Object, Object>)object).entrySet().iterator();
            while (it.hasNext()) {
                Map.Entry<Object, Object> entry = it.next();
                String name = entry.getKey().toString();
                Object value = entry.getValue();
                checkCircularReference(object, value);

                writeName(name);
                write(value);
                if (it.hasNext()) {
                    writeComma();
                }
            }

            closeCurlyBracket();
        } else if (object instanceof Collection<?>) {
            openSquareBracket();

            @SuppressWarnings("unchecked")
            Iterator<Object> it = ((Collection<Object>)object).iterator();
            while (it.hasNext()) {
                Object value = it.next();
                checkCircularReference(object, value);

                write(value);
                if (it.hasNext()) {
                    writeComma();
                }
            }

            closeSquareBracket();
        } else if (object.getClass().isArray()) {
            openSquareBracket();

            int len = Array.getLength(object);
            for (int i = 0; i < len; i++) {
                Object value = Array.get(object, i);
                checkCircularReference(object, value);

                if (i > 0) {
                    writeComma();
                }
                write(value);
            }

            closeSquareBracket();
        } else {
            String[] readablePropertyNames = BeanUtils.getReadablePropertyNamesWithoutNonSerializable(object);
            if (readablePropertyNames != null && readablePropertyNames.length > 0) {
                openCurlyBracket();

                for (int i = 0; i < readablePropertyNames.length; i++) {
                    Object value;
                    try {
                        value = BeanUtils.getProperty(object, readablePropertyNames[i]);
                    } catch (InvocationTargetException e) {
                        throw new IOException(e);
                    }
                    checkCircularReference(object, value);

                    writeName(readablePropertyNames[i]);
                    write(value);
                    if (i < (readablePropertyNames.length - 1)) {
                        writeComma();
                    }
                }

                closeCurlyBracket();
            } else {
                writeValue(object.toString());
            }
        }
        return this;
    }
1322413
def write(self, document, obj, *args, **kwargs):
        
        try:
            document = IWritableDocument(document)
            mime_type = document.mime_type
            writer = self.lookup_writer(mime_type, obj)
            if not writer:
                msg = ("No adapter found to write object %s to %s document"
                       % (obj.__class__.__name__, mime_type))
                raise NoWriterFoundError(msg)
            return writer.write(document, obj, *args, **kwargs)
        except:
            return defer.fail(Failure())
1121031
function( options ){
      var obj = options.map;
      var key;
      var keys = options.keys;
      var l = keys.length;

      for(var i = 0; i < l; i++){
        var key = keys[i];

        if( $$.is.plainObject( key ) ){
          $$.util.error('Tried to set map with object key');
        }

        if( i < keys.length - 1 ){
          
          // extend the map if necessary
          if( obj[key] == null ){
            obj[key] = {};
          }
          
          obj = obj[key];
        } else {
          // set the value
          obj[key] = options.value;
        }
      }
    }