我有两个 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" ]
}
我检查了执行此操作的 crate json-patch,但它不能针对稳定的 Rust 进行编译。是否可以使用serde_json和 stable Rust之类的东西做类似的事情?