我有一个包含以下内容的 JSON 对象:
[
{
"_id":"5078c3a803ff4197dc81fbfb",
"email":"user1@gmail.com",
"image":"some_image_url",
"name":"Name 1"
},
{
"_id":"5078c3a803ff4197dc81fbfc",
"email":"user2@gmail.com",
"image":"some_image_url",
"name":"Name 2"
}
]
我想将“_id”键更改为“id”,这样它就会变成
[
{
"id":"5078c3a803ff4197dc81fbfb",
"email":"user1@gmail.com",
"image":"some_image_url",
"name":"Name 1"
},
{
"id":"5078c3a803ff4197dc81fbfc",
"email":"user2@gmail.com",
"image":"some_image_url",
"name":"Name 2"
}
]
我将如何使用 Javascript、jQuery 或 Ruby、Rails 来做到这一点?
谢谢。