代码拉取完成,页面将自动刷新
package gojsondiff_test
import (
. "github.com/yudai/gojsondiff"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/yudai/gojsondiff/tests"
"encoding/json"
"fmt"
"github.com/yudai/pp"
)
var _ = Describe("Gojsondiff", func() {
Describe("Unmarshaller", func() {
Describe("CompareObjects", func() {
It("", func() {
um := NewUnmarshaller()
diff, err := um.UnmarshalString(`
{
"summary": [
"@@ -638,17 +638,17 @@\n via, Bra\n-z\n+s\n il, %0ACh\n@@ -916,20 +916,13 @@\n re a\n-lso known as\n+.k.a.\n Car\n",
0,
2
],
"surface": [
17840000,
0,
0
],
"demographics": {
"population": [
385742554,
385744896
]
},
"languages": {
"2": [
"inglés"
],
"_t": "a",
"_2": [
"english",
0,
0
]
},
"countries": {
"0": {
"capital": [
"Buenos Aires",
"Rawson"
]
},
"9": [
{
"name": "Antártida",
"unasur": false
}
],
"10": {
"population": [
42888594
]
},
"_t": "a",
"_4": [
"",
10,
3
],
"_8": [
"",
2,
3
],
"_10": [
{
"name": "Uruguay",
"capital": "Montevideo",
"independence": "1825-08-25T07:00:00.000Z",
"unasur": true
},
0,
0
],
"_11": [
{
"name": "Venezuela",
"capital": "Caracas",
"independence": "1811-07-05T07:00:00.000Z",
"unasur": true
},
0,
0
]
},
"spanishName": [
"Sudamérica"
]
}
`)
Expect(err).To(BeNil())
pp.Print(diff)
a := LoadFixture("FIXTURES/jsondiffpatch.json")
differ := New()
differ.ApplyPatch(a, diff)
pp.Println(a)
result, _ := json.Marshal(a)
fmt.Println(string(result))
})
})
})
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。