I have two JSON files:
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来实现类似的功能?
merge
之前需要检查v.is_null()
。 - Arnavion