【发布时间】:2017-11-02 08:40:11
【问题描述】:
我有两个 JSON 文件:
JSON 1
{
"title": "This is a title",
"person" : {
"firstName" : "John",
"lastName" : "Doe"
},
"cities":[ "london", "paris" ]
}
JSON 2
{
"title": "This is another title",
"person" : {
"firstName" : "Jane"
},
"cities":[ "colombo" ]
}
我想将 #2 合并到 #1 中,其中 #2 覆盖 #1,产生以下输出:
{
"title": "This is another title",
"person" : {
"firstName" : "Jane",
"lastName" : "Doe"
},
"cities":[ "colombo" ]
}
我检查了板条箱json-patch,它可以做到这一点,但它不能针对稳定的 Rust 进行编译。是否可以使用 serde_json 和稳定的 Rust 做类似的事情?
【问题讨论】:
标签: json rust serde json-patch serde-json