FILE module
Work with local JSON data on your own computer
file = require('file.js') // use the file module
// create an object
myObject = {
firstname : 'John',
lastName : 'Doe',
dateOfBirth : '1982-06-24'
}
// save it
file.write('people/john doe.json', myObject)
// read it back
obj2 = file.read('people/john doe.json')
// create array of (simple) journals)
journals = [
{
id : 123,
date : '2024-10-12',
lines : [
{
account : '0200',
amount : 100
},
{
account : '0600',
amount : -100
}
]
},
{
id : 345,
date : '2024-10-15',
lines : [
{
account : '0200',
amount : 520
},
{
account : '0600',
amount : -520
}
]
}
]
// write it to disk
file.write('journals/2024/10.json', myObject)
// read it back
j2 = file.read('journals/2024/10.json')
Last updated