auto x = JSONValue(["age":42, "name":"Bob"]);
"data.json".write(x.toJSON);
(write-value (file "data.json") x)
await File.WriteAllTextAsync("data.json", JsonSerializer.Serialize(x));
class JsonModel {
// Create Field
int id;
String qrText, licen, trans, name;
// // Constructor
// JsonModel(
// int idInt, String nameString, String userString, String passwordString) {
// // id=idInt;
// // name =nameString;
// // user =userString;
// // password = passwordString;
// }
JsonModel(this.id, this.name, this.licen, this.trans, this.qrText);
JsonModel.fromJson(Map<String, dynamic> parseJSON) {
id = int.parse(parseJSON['id']);
licen = parseJSON['Li
buffer, err := json.MarshalIndent(x, "", " ")
if err != nil {
return err
}
err = os.WriteFile("data.json", buffer, 0644)
new File("data.json").text = new JsonBuilder(x).toPrettyString()
fs.writeFileSync('data.json', JSON.stringify(x));
(with-open-file (out "data.json" :direction :output)
(yason:encode-plist x out))
file = io.open("data.json", "w")
file:write(cjson.encode(x))
file:close()
file_put_contents('data.json', json_encode($x));
var
str: TMemoryStream;
jss: string;
begin
with TJSONStreamer.Create(nil) do try
str := TMemoryStream.Create;
try
jss := ObjectToJSONString(x);
str.Write(jss[1], length(jss));
str.SaveToFile('data.json');
finally
str.Free;
end;
finally
Free;
end;
end.
write_file('data.json', encode_json($x));
with open("data.json", "w") as output:
json.dump(x, output)
x = {:hello => "goodbye"}
File.open("data.json", "w") do |f|
f.puts(x.to_json)
end
::serde_json::to_writer(&File::create("data.json")?, &x)?