Writes the given system test definition the form of a JSON document.
333536
public void write( IGeneratorSet generatorSet)
    {
    JsonWriterFactory writerFactory = Json.createWriterFactory( MapBuilder.of( PRETTY_PRINTING, true).build());
    JsonWriter jsonWriter = writerFactory.createWriter( getWriter());

    jsonWriter.write( GeneratorSetJson.toJson( generatorSet));
    }
313740
function writeJSON(dbName, schema) {

    var baseUrl = 'http://www.filltext.com/?',
        promises = [],
        collection;

    for (collection in schema) {

        var meta = schema[collection].meta,
            fields = meta.fields,
            url;

        url = Object.keys(fields).map(function(key) {
            if (fields[key][0] === '[' && fields[key].slice(-1) === ']') {
                return key + '=' + fields[key];
            }
            return key + '={' + fields[key] + '}';
        }).join('&') + '&rows=' + meta.rows;

        console.log('Url for', collection, url);

        (function(c) {
            promises.push(fetch(baseUrl + url).then(function(response) {
                return response.json();
            })
            .then(function(rows) {
                schema[c] = rows;
            }));
        })(collection);
    }

    return Promise.all(promises).then(function() {
        fs.writeFile(dbName, JSON.stringify(schema, null, 4), function(err) {
            if (err) {
                Promise.reject('Failed to save JSON file: ' + err);
            }
        });
    });
}
622955
private void writeJobState(JsonWriter jsonWriter, JobState jobState) throws IOException {
    jobState.toJson(jsonWriter, this.keepConfig);
  }
1253811
def write_json_document(title, body):
    
    if not title.endswith('.json'):
        title += '.json'

    json_body = create_json_str(body)

    if os.path.exists(title):
        juicer.utils.Log.log_warn("Cart file '%s' already exists, overwriting with new data." % title)

    f = open(title, 'w')
    f.write(json_body)
    f.flush()
    f.close()
407162
def write(self, node, filehandle):
        """"""
        dictexporter = self.dictexporter or DictExporter()
        data = dictexporter.export(node)
        return json.dump(data, filehandle, **self.kwargs)
1305103
@Override
    public void newDoc() throws IOException {
        sb = new StringBuilder();
        baos = new ByteArrayOutputStream();
        generator = jsonFactory.createJsonGenerator(baos);
        generator.writeStartObject(); 
    }
1324748
public void write(JsonGenerator jsonGenerator) throws IOException {
    // We neither need the list of RequestedNodes, nodes, nor excludedHosts,
    // because we can reconstruct them from the request object
    jsonGenerator.writeStartObject();
    jsonGenerator.writeObjectField("request", request);
    jsonGenerator.writeEndObject();
  }
588085
private void writeActions(List<Action> actions)
            throws JsonGenerationException, IOException {
        List<String> actionStrings = new ArrayList<String>();

        for (Action action : actions) {
            actionStrings.add(action.getActionName());
        }
        writeJsonArray(JsonDocumentFields.ACTION, actionStrings);
    }
262600
def _write_json(file, contents):
    """"""
    with open(file, 'w') as f:
        return json.dump(contents, f, indent=2, sort_keys=True)
1085451
def _write_json(self, message, extra):
        '''
        
        '''
        self.logger.info(message, extra=extra)
670840
def _write_jsonl(filepath, data, kwargs):
    """"""
    with io_stl.open(filepath, 'w', encoding='utf8') as outfile:
        kwargs['indent'] = None  # JSON has to be on one line!
        if 'sort_keys' not in kwargs:
            kwargs['sort_keys'] = True
        if 'separators' not in kwargs:
            kwargs['separators'] = (',', ': ')
        if 'ensure_ascii' not in kwargs:
            kwargs['ensure_ascii'] = False
        for line in data:
            str_ = json.dumps(line, **kwargs)
            outfile.write(to_unicode(str_))
            outfile.write(u'\n')
    return data
480374
public void write( Document document ) {
        assert document != null;
        ++count;
        ++totalCount;
        if (count > maxDocumentsPerFile) {
            // Close the stream (we'll open a new one later in the method) ...
            close();
            count = 1;
        }
        try {
            if (stream == null) {
                // Open the stream to the next file ...
                ++fileCount;
                String suffix = StringUtil.justifyRight(Long.toString(fileCount), BackupService.NUM_CHARS_IN_FILENAME_SUFFIX, '0');
                String filename = filenamePrefix + "_" + suffix + DOCUMENTS_EXTENSION;
                if (compress) filename = filename + GZIP_EXTENSION;
                currentFile = new File(parentDirectory, filename);
                OutputStream fileStream = new FileOutputStream(currentFile);
                if (compress) fileStream = new GZIPOutputStream(fileStream);
                stream = new BufferedOutputStream(fileStream);
            }
            Json.write(document, stream);
            // Need to append a non-consumable character so that we can read multiple JSON documents per file
            stream.write((byte)'\n');
        } catch (IOException e) {
            problems.addError(JcrI18n.problemsWritingDocumentToBackup, currentFile.getAbsolutePath(), e.getMessage());
        }
    }
759656
public <T> String write(final T object, final DataTypeDescriptor<T> descriptor,
			final boolean indent) {
		try {
			return jsonFormat.write(object, descriptor, indent);
		} catch (Exception e) {
			throw propagate(e);
		}
	}
472678
def write_json(self, **kwargs):
        
        self.stdout.write(json.dumps(kwargs) + "\n")
        self.stdout.flush()
1017981
Writer write(Writer writer, int indentFactor, int indent)
            throws JSONException {
        try {
            boolean commanate = false;
            final int length = this.length();
            Iterator<String> keys = this.keys();
            writer.write('{');

            if (length == 1) {
                Object key = keys.next();
                writer.write(quote(key.toString()));
                writer.write(':');
                if (indentFactor > 0) {
                    writer.write(' ');
                }
                writeValue(writer, this.map.get(key), indentFactor, indent);
            } else if (length != 0) {
                final int newindent = indent + indentFactor;
                while (keys.hasNext()) {
                    Object key = keys.next();
                    if (commanate) {
                        writer.write(',');
                    }
                    if (indentFactor > 0) {
                        writer.write('\n');
                    }
                    indent(writer, newindent);
                    writer.write(quote(key.toString()));
                    writer.write(':');
                    if (indentFactor > 0) {
                        writer.write(' ');
                    }
                    writeValue(writer, this.map.get(key), indentFactor, newindent);
                    commanate = true;
                }
                if (indentFactor > 0) {
                    writer.write('\n');
                }
                indent(writer, indent);
            }
            writer.write('}');
            return writer;
        } catch (IOException exception) {
            throw new JSONException(exception);
        }
    }
844528
@Override
   public void writeXmlBody(Definition def, Writer out) throws IOException
   {
      writeConnectorVersion(out);

      int indent = 1;
      writeIndent(out, indent);
      out.write("<display-name>Display Name</display-name>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<vendor-name>Red Hat Inc</vendor-name>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<spec-version>1.0</spec-version>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<eis-type>Test RA</eis-type>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<version>0.1</version>");
      writeEol(out);

      writeIndent(out, indent);
      out.write("<resourceadapter>");
      writeEol(out);

      writeOutbound(def, out, indent + 1);

      writeIndent(out, indent);
      out.write("</resourceadapter>");
      writeEol(out);
      out.write("</connector>");
      writeEol(out);
   }
865402
def write_json_file(argname, cmd, basename, filename):
    

    value = getattr(cmd.distribution, argname, None)

    if isinstance(value, dict):
        value = json.dumps(
            value, indent=4, sort_keys=True, separators=(',', ': '))

    cmd.write_or_delete_file(argname, filename, value, force=True)