I am trying to append a single quote and also add double quote, but it shows an error as follows
[ts] ':' expected
"id": " + ' + jsonObject["school_id"] + ' + "
expected output would be something similar as follows
"id" : "'12345'"
You can't just use '
like that.
If you want to include single quotes in the string, enclose them in a string.
const jsonObject = {"school_id": "12345"}
const obj = {"id": "'" + jsonObject["school_id"] + "'"}
console.log(obj);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With