我得到例外:
“error_code”:4001,“message”:“请求不正确。{} [无法读取 JSON:意外的字符('''(代码39))
执行时:
def process = ["curl", '-k', "-X", "POST", "-H", "Content-Type: application/json", '--user', "user:pass", '-d', """\'{
\"description\": \"string\",
\"mode\": \"DEFAULT\",
\"name\": \"string\",
\"start_time\": \"2015-11-05T13:26:40.626Z\",
\"tags\": [
\"string\"
]
}\'""", 'https://some_url'].execute()
请指出我的错误。
答案 0 :(得分:1)
这是因为在三引号多行字符串中,您不需要转义chart = new Rubix('#stacked-multi-series-bar-chart', {
title: self.state.question,
//subtitle: 'Comparison across employee groups',
titleColor: '#EE682F',
subtitleColor: '#EE682F',
height: 300,
axis: {
x: {
type: 'ordinal',
},
y: {
type: 'linear',
tickFormat: self.state.absoluteActive?'.0f':'%'
}
},
grouped: true,
show_markers: true
});
var series = chart.bar_series({
name: department,
color: colors[index]
});
series.addData(seriesData);
字符
不要用手工制作JSON,只需使用JsonBuilder:
"