Can someone figure out, why I get this error when I try to append a key/value to this JSON object?
$ node t.js
undefined:1
[object Object]
^
SyntaxError: Unexpected token o in JSON at position 1
t.js
const toml = require('./toml');
const moment = require('moment');
const t = toml('./non-production.toml');
let a = new Object;
a = JSON.parse(t.Jira.pack.c);
const time = moment().format("YYYY-MM-DDTHH:mm:ss.SSSZZ");
a["customfield_11904"] = time;
console.log(JSON.parse(a));
toml.js
const TOML = require('@iarna/toml');
const fs = require('fs');
module.exports = (filename) => {
return TOML.parse(fs.readFileSync(filename, 'utf-8'));
}
non-production.toml
[Jira]
pack.c = '{ "project": { "key": "DEMO" }, "issuetype": { "id": 10002 }, "priority": { "id": "3" }}'