我正在尝试使用 Go 以特定格式编组 JSON。我正在遍历 JSON 并打印单个对象响应。我想要的是根据一种格式存储所有对象。现在我卡住了,像这样封送 JSON 结果:
{
"Address":null,
"Email":"abc@hotmail.com",
"HashedPassword":"4233137d1c510f2e55ba5cb220b864b11033f156",
"DeHashedPassword":"123456",
"ID":"Gd0YhYEJdE6oejsjBm7xLTQ4lWIaRecbS-k=",
"IPAddress":null,
"Name":null,
"ObtainedFrom":"LinkedIn",
"Password":null,
"Phone":null,
"Username":null,
"Vin":null,
"Success":true
}{
"Address":"",
"Email":"abc@hotmail.com",
"HashedPassword":"",
"DeHashedPassword":"123456",
"ID":"Jge4Mm6M-5-yJedG2ql48M9H2p7qP83aggM=",
"IPAddress":"",
"Name":"",
"ObtainedFrom":"DailyMotion.com",
"Password":"dm_51978c5a67a88",
"Phone":"",
"Username":"",
"Vin":"",
"Success":true
}{
"Address":"",
"Email":"abc@hotmail.com",
"HashedPassword":"",
"DeHashedPassword":"123456",
"ID":"9k8llNeinyrmxhL7yg3zZ50rQiQk_BmzZS8=",
"IPAddress":"",
"Name":"",
"ObtainedFrom":"BreachCompilation",
"Password":"hello123",
"Phone":"",
"Username":"",
"Vin":"",
"Success":true
}
我想要得到的是像这样编组 json
{
"entries": [
{
"id": "CHzLLBdoJiwd7WaySw8QBOoxkj2lmKFhJK8=",
"email": "abc@hotmail.com",
"username": null,
"password": null,
"hashed_password": "4233137d1c510f2e55ba5cb220b864b11033f156",
"name": null,
"vin": null,
"address": null,
"ip_address": null,
"phone": null,
"obtained_from": "LinkedIn"
},
{
"id": "O6W3lxVMo_faf7MWoGGgkMb_CGcjo5vinFQ=",
"email": "abc@hotmail.com",
"username": "",
"password": "dm_51978c5a67a88",
"hashed_password": "",
"name": "",
"vin": "",
"address": "",
"ip_address": "",
"phone": "",
"obtained_from": "DailyMotion.com"
}
],
"success": true
}
慕沐林林
相关分类