Dgraph load error with `dgraph live`

Hi,
I have a problem when I try to load test data with dgraph live -f data.json as below.
Can you help me to make it? Thanks

[root@kg ~]# head -2 data1.json
{"user_id":3,"user_name":"ZmoscJ","register_time":"2020-06-08 20:24:03","browser":[{"browser_times":6,"browser_chapter":{"chapter_id":5,"chapter_title":"在你心里,...?","belong_course":{"course_id":5,"course_name":"金融...50讲"}}},{"browser_times":6,"browser_chapter":{"chapter_id":17,"chapter_title":"社交....吗?","belong_course":{"course_id":17,"course_name":"y...讲堂"}}},{"browser_times":2,"browser_chapter":{"chapter_id":8,"chapter_title":"“幸福”","belong_course":{"course_id":8,"course_name":"测试"}}}]}
{"user_id":4,"user_name":"🍃☁⚡💦☔","register_time":"2020-06-08 20:25:06","browser":[{"browser_times":1,"browser_chapter":{"chapter_id":2,"chapter_title":"测试财...","belong_course":{"course_id":2,"course_name":"给...课"}}},{"browser_times":1,"browser_chapter":{"chapter_id":18,"chapter_title":"测试...课","belong_course":{"course_id":18,"course_name":" J...四讲"}}},{"browser_times":2,"browser_chapter":{"chapter_id":1,"chapter_title":"测试...","belong_course":{"course_id":1,"course_name":"给...课"}}},{"browser_times":7,"browser_chapter":{"chapter_id":17,"chapter_title":"社交....吗?","belong_course":{"course_id":17,"course_name":"t讲堂"}}},{"browser_times":1,"browser_chapter":{"chapter_id":16,"chapter_title":"社交...吗?","belong_course":{"course_id":16,"course_name":"基于...设施"}}},{"browser_times":1,"browser_chapter":{"chapter_id":14,"chapter_title":"微信","belong_course":{"course_id":14,"course_name":"经济...的"}}},{"browser_times":1,"browser_chapter":{"chapter_id":6,"chapter_title":"“报....吗","belong_course":{"course_id":6,"course_name":"“报...行”"}}},{"browser_times":8,"browser_chapter":{"chapter_id":5,"chapter_title":"在你...吗?","belong_course":{"course_id":5,"course_name":"金融...50讲"}}},{"browser_times":1,"browser_chapter":{"chapter_id":4,"chapter_title":"“报复...吗","belong_course":{"course_id":4,"course_name":"“报...行”"}}},{"browser_times":1,"browser_chapter":{"chapter_id":3,"chapter_title":"第...课","belong_course":{"course_id":3,"course_name":"金融...课"}}}]}
[root@kg ~]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                                                    NAMES
163be77f96ad        dgraph/standalone   "/run.sh"           11 days ago         Up 11 days          0.0.0.0:8000->8000/tcp, 0.0.0.0:8080->8080/tcp, 0.0.0.0:9080->9080/tcp   musing_tesla
[root@kg ~]# docker exec -it 163be77f96ad /bin/bash
root@163be77f96ad:/dgraph# dgraph live -f data1.json
[Decoder]: Using assembly version of decoder
I0908 13:37:55.593430     197 init.go:102]

Dgraph version   : v20.07.0
Dgraph codename  : shuri
Dgraph SHA-256   : 4cd320fc6eab163ab68602a5122a6c82c8467c2ed5ac93478d5f40d44eec71c4
Commit SHA-1     : d65e20530
Commit timestamp : 2020-07-28 15:31:37 -0700
Branch           : HEAD
Go version       : go1.14.4

For Dgraph official documentation, visit https://dgraph.io/docs/.
For discussions about Dgraph     , visit http://discuss.dgraph.io.
To say hi to the community       , visit https://dgraph.slack.com.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2020 Dgraph Labs, Inc.


I0908 13:37:55.593972     197 util_ee.go:126] KeyReader instantiated of type <nil>

Running transaction with dgraph endpoint: 127.0.0.1:9080
Found 1 data file(s) to process
Processing data file "data1.json"
2020/09/08 13:37:55 JSON map is followed by illegal rune "{"
github.com/dgraph-io/dgraph/chunker.(*jsonChunker).Chunk
	/ext-go/1/src/github.com/dgraph-io/dgraph/chunker/chunk.go:239
github.com/dgraph-io/dgraph/dgraph/cmd/live.(*loader).processLoadFile
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:347
github.com/dgraph-io/dgraph/dgraph/cmd/live.(*loader).processFile
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:272
github.com/dgraph-io/dgraph/dgraph/cmd/live.run.func2
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:486
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1373

github.com/dgraph-io/dgraph/x.Check
	/ext-go/1/src/github.com/dgraph-io/dgraph/x/error.go:42
github.com/dgraph-io/dgraph/dgraph/cmd/live.(*loader).processLoadFile
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:357
github.com/dgraph-io/dgraph/dgraph/cmd/live.(*loader).processFile
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:272
github.com/dgraph-io/dgraph/dgraph/cmd/live.run.func2
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:486
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1373
root@163be77f96ad:/dgraph#

Your data should be a list.

[
          {"user_id":3,"use .... },
          {"user_id":4,"use ....}
] 

Thanks ! Now it works for me. :+1:t2:

1 Like