Is somethhing like this possible in json
let a = {
"awe
sdsds" : "eweq
dfs
ewewew"
}
can i have multiline strings as key and value
I tried and got ↵ this icon at newline for key and \n this at newline for value
This is not "JSON", it is object literal.
If you are having a literal you can use string literals and computed properties if you really want to have this kind of keys. Otherwise you'd need to use escape seq \n
(see the result of JSON.stringify
)
let a = {
[`awe
sdsds`] : `eweq
dfs
ewewew`
}
console.log(a[`awe
sdsds`])
console.log(JSON.stringify(a))