我有以下来自活动记录查询的输出
[{"image_id"=>1, "image_name"=> "image1", action_type"=>"Call", "count"=>2},
`{"image_id"=>1, "image_name"=> "image1","action_type"=>"sms", "count"=>1},
{"image_id"=>2, "image_name"=> "image2","action_type"=>"sms", "count"=>1} ]`
现在我希望将其转换为 Json 对象,如下所示
{ "1": { "counts": { "call": 2, "sms": 1 } , "title":'image1' },
"2": { "counts": {"sms": 1} , 'title':'image2'}}