我在这里遇到一个带有Spring Boot Application的小麻烦。根据我的理解,Jackson依赖项是通过spring-boot-starter-web自动配置的,并且将对象的序列化/反序列化为JSON,以注释为@RestController。
问题是它的行为与预期不同,而是以纯文本/文本格式返回响应。
下面是我要执行的代码段。
@GetMapping(value = "/user/",produces = "application/JSON")
public List<String> getUser(){
List<String> newUsers = new ArrayList<String>();
newUsers.add("User 1");
newUsers.add("User 2");
newUsers.add("User 3");
return newUsers;
}
谢谢 J
答案 0 :(得分:0)
是的,只是一个JSON数组也是有效的JSON。如果要以对象形式输出JSON:
fig, ax = plt.subplots(figsize=(6, 4))
(df.May2019.T/2).plot(kind='barh',
title='Number of customers per revenue slice',
width=0.99, ax=ax)
(df.May2019.T/-2).plot(kind='barh', width=0.99, ax=ax)
ax.set_yticklabels(['60%-80%', '40%-60%', '20%-40%', '0%-20%'])
ax.set_ylabel('Top x% Revenue')
ax.set_xlabel('Number of customers in revenue band')
plt.show()
您可以:
loci <- read.table(header = TRUE, text="Gene AreaID Label
DNAJC12 rs1111111 unlikely
HERC4 rs1111111 unlikely
RP11-57G10.8 rs2222222 possible
RPL12P8 rs1111111 unlikely
SIRT1 rs3333333 certain
RP11-57G10.8 rs3333333 possible
RPL12P8 rs3333333 unlikely
SIRT1 rs3333333 unlikely")
#Get AreaID where all are labelled unlikely
tt <- aggregate(cbind(all=Label=="unlikely") ~ AreaID, data=loci, FUN=all)
#Merge with those AreaID's to get Genes
merge(loci, tt[tt$all,]["AreaID"])
# AreaID Gene Label
#1 rs1111111 DNAJC12 unlikely
#2 rs1111111 HERC4 unlikely
#3 rs1111111 RPL12P8 unlikely