我尝试过:
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver()
但是网络核心3初创公司不支持此分配
答案 0 :(得分:1)
.Net核心现在使用System.Text.Json,但您仍然可以使用Newtonsoft。 在您的startup.cs文件中,在ConfigureServices方法中添加以下内容。
library(data.table)
packageVersion('data.table')
#[1] ‘1.12.8’
#the empty table to be filled
DT <- data.table(
"ID" = c("a", "b", "c", "d"),
"A" = numeric(4),
"B" = numeric(4),
"C" = numeric(4)
)
# ID A B C
#1: a 0 0 0
#2: b 0 0 0
#3: c 0 0 0
#4: d 0 0 0
#table with part of the results
DT_short <- data.table(
"ID" = c("a", "b", "d"),
"A" = 1:3,
"B" = 1:3
)
# ID A B
#1: a 1 1
#2: b 2 2
#3: d 3 3
#table with part of the results 2
DT_shorter <- data.table(
"ID" = c("c"),
"A" = 7,
"B" = 70,
"C" = 3.14
)
# ID A B C
#1: c 7 70 3.14
DT[match(DT_short$ID, DT$ID), match(names(DT_short), names(DT))] <- DT_short
DT[match(DT_shorter$ID, DT$ID), match(names(DT_shorter), names(DT))] <- DT_shorter
DT
# ID A B C
#1: a 1 1 0.00
#2: b 2 2 0.00
#3: c 7 70 3.14
#4: d 3 3 0.00
应该这样做