Hi,
I have a json file that contains millions of records in given form. As you can guess reading the whole content won’t be memory efficient. How do we approach such problem in Go? For a demonstration purposes, I don’t mind seeing a solution where the struct is printed as the file content is read.
Thanks
user.json
{
"ID-1": {
"username": "name-1",
"password": "password-1"
},
"ID-2": {
"username": "name-2",
"password": "password-2"
},
"ID-3": {
"username": "name-3",
"password": "password-3"
}
}
user struct (Or some other struct if it simplifies the solution)
type User struct {
ID string `json:"id"`
Username string `json:"username"`
Password string `json:"password"`
}