To create multiline strings in json I use the following:
"defaultTemplates" : {
"vcs.vcm.layer.Vector" : {
"<html><head></head><body>",
"<div style='position:fixed;>",
"...."
However, JShint doesnt like this very much and reports: "Expected colon instead saw comma", which normally makes sense, but not for a multiline string..
Anybody knows how to either create multiline strings differently so that jshint is ok, or else.. how to disable this warning in jshint ?
You could store the multiline string as an array in JSON.
"template": {
"lines": [
"line1",
"line2",
"line3"
]
}
Then, use JavaScript code to join the lines with newline characters.
var multilineString = template.lines.join("\n");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.