|
Oktatás * Programozás 2 * Szkriptnyelvek * Adator. prog. Teaching * Prog. for Data Sci. Félévek Linkek * kalendárium |
DLang /
Create a JSON object
Output:
{"age":30,"hobbies":["reading","gaming","coding"],"isStudent":false,"name":"John"}
{"age":30,"hobbies":["reading","gaming","coding"],"isStudent":false,"name":"John"}
Output of v1 and v2 (they're equivalent):
{"age":30,"hobbies":["reading","gaming","coding"],"isStudent":false,"name":"John"}
Output of v3:
{
"age": 30,
"hobbies": [
"reading",
"gaming",
"coding"
],
"isStudent": false,
"name": "John"
}
You could also write to a .json file with a one-liner: File("person.json", "w").writeln(person); |
![]() Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |