Writes all data that was collected about classes to a json file.
553244
private void writeClassData() {
		try (PrintStream out = new PrintStream(openResultFileOuputStream(
				resultDirectory, "classes.json"))) {
			out.println("{");

			// Add direct subclass information:
			for (Entry<Integer, ClassRecord> classEntry : this.classRecords
					.entrySet()) {
				if (classEntry.getValue().subclassCount == 0
						&& classEntry.getValue().itemCount == 0) {
					continue;
				}
				for (Integer superClass : classEntry.getValue().directSuperClasses) {
					this.classRecords.get(superClass).nonemptyDirectSubclasses
							.add(classEntry.getKey().toString());
				}
			}

			int count = 0;
			int countNoLabel = 0;
			for (Entry<Integer, ClassRecord> classEntry : this.classRecords
					.entrySet()) {
				if (classEntry.getValue().subclassCount == 0
						&& classEntry.getValue().itemCount == 0) {
					continue;
				}

				if (classEntry.getValue().label == null) {
					countNoLabel++;
				}

				if (count > 0) {
					out.println(",");
				}
				out.print("\"" + classEntry.getKey() + "\":");
				mapper.writeValue(out, classEntry.getValue());
				count++;
			}
			out.println("\n}");

			System.out.println(" Serialized information for " + count
					+ " class items.");
			System.out.println(" -- class items with missing label: "
					+ countNoLabel);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
277248
def store_json(self, filename, dict_to_store):
        """"""
        filename = os.path.join(
            self.data_dir,
            filename + '.data'
        )
        fileops.dump_dict_to_file(
            dict_to_store,
            filename
        )
259480
def write_json(data, path, file_name):
    
    if os.path.exists(path) and not os.path.isdir(path):
        return
    elif not os.path.exists(path):
        mkdir_p(path)
    with open(os.path.join(path, file_name), 'w') as f:
        json_tricks.dump(data, f, indent=4, primitives=True, allow_nan=True)
1127262
def write_json_to_file(path, data):
    
    with open(path, 'w', encoding='utf-8') as f:
        json.dump(data, f)
756929
public void writeJSON(JSONValue jc, JSONWriter jb, boolean writeClass)
            throws IOException {
        jb.arrayBegin();
        for (Object item : mArray) {
            if (item == null)
                jb.valueNull();
            else
                jc.writeValue(item, jb, writeClass);
        }
        jb.arrayEnd();
    }
924189
def toJson(self, data=None, pretty=False):
        """"""
        if data==None: data = self.attrs
        data = self.flatten(data) # don't send objects as str in json
        #if pretty:
        ret = json.dumps(data, indent=4, sort_keys=True)
        #self.inflate() # restore objects from json str data
        return ret
602543
private void saveJsonFile(final List<StepImplementationsDescriptor> classStepTags) {

        Gson gson = new GsonBuilder().create();

        final String json = gson.toJson(classStepTags);

        writeOutputFile(json, "stepimplementations.json");
    }
1024985
private void writeJsonForArchive(PrintWriter wrt, List<RecentJobEvent> jobs) {
		
		wrt.write("[");
		
		// sort jobs by time
		Collections.sort(jobs,  new Comparator<RecentJobEvent>() {
			@Override
			public int compare(RecentJobEvent o1, RecentJobEvent o2) {
				if(o1.getTimestamp() < o2.getTimestamp()) {
					return 1;
				} else {
					return -1;
				}
			}
			
		});
		
		// Loop Jobs
		for (int i = 0; i < jobs.size(); i++) {
			RecentJobEvent jobEvent = jobs.get(i);
			
			//Serialize job to json
			wrt.write("{");
			wrt.write("\"jobid\": \"" + jobEvent.getJobID() + "\",");
			wrt.write("\"jobname\": \"" + jobEvent.getJobName()+"\",");
			wrt.write("\"status\": \""+ jobEvent.getJobStatus() + "\",");
			wrt.write("\"time\": " + jobEvent.getTimestamp());
			
			wrt.write("}");
			
			//Write seperator between json objects
			if(i != jobs.size() - 1) {
				wrt.write(",");
			}
		}
		wrt.write("]");
		
	}
285598
function writeJSON(file, json){
	var s = file.split(".");
	if (s.length > 0) {
		var ext = s[s.length - 1];
		if (ext != "json"){
			file = file + ".json";
		}
	}
  fs.writeFileSync(file, JSON.stringify(json));
}
1175555
def __write_json_file(path, values):
    """"""
    # Sort the keys to ensure ordering
    sort_order = ['name', 'switch', 'comment', 'value', 'flags']
    sorted_values = [
        OrderedDict(
            sorted(
                value.items(), key=lambda value: sort_order.index(value[0])))
        for value in values
    ]

    with open(path, 'w') as f:
        json.dump(sorted_values, f, indent=2, separators=(',', ': '))
1213145
def to_json_file(file, data, pretty):
    
    json_string = to_json(data, pretty)
    file_utils.write_to_file(file, json_string)
1129157
def write_json_plan(self, proposed_layout, proposed_plan_file):
        """"""
        with open(proposed_plan_file, 'w') as output:
            json.dump(proposed_layout, output)
479868
def write(self):
        """"""
        if (self.data):
            dataPath = self.client.local_dir / (urllib.parse.quote_plus(self.uri)+'.json')
            with dataPath.open(mode='w') as dump_file:
                json.dump(self.data, dump_file)
                dump_file.close()
            logger.info('Wrote ' + self.uri + ' to file')
            return True
        else:
            logger.warning('No data to write for ' + self.uri)
            return False
837502
def write_json_to_temp_file(data):
    """"""
    fp = tempfile.NamedTemporaryFile(delete=False)
    fp.write(json.dumps(data).encode('utf-8'))
    fp.close()
    return fp.name
519334
public static String json(Object obj, boolean writeClass,
                              Converter<Object, Map<String, Object>> mc) throws IOException {
        if (obj == null)
            return NULL;
        StringWriter sw = new StringWriter();
        try {
            json(obj, sw, writeClass, mc);
            return sw.getBuffer().toString();
        } finally {
            sw.close();
        }
    }
778224
def store_data(data):
    
    with open(url_json_path) as json_file:
        try:
            json_file_data = load(json_file)
            json_file_data.update(data)
        except (AttributeError, JSONDecodeError):
            json_file_data = data
    with open(url_json_path, 'w') as json_file:
        dump(json_file_data, json_file, indent=4, sort_keys=True)
1294112
private function writeClassTrailer(): void
  {
    $this->codeStore->appendSeparator();
    $this->codeStore->append('}');
    $this->codeStore->append('');
    $this->codeStore->appendSeparator();
  }