Is there any quick way to convert the former data structure into the latter one?

data structure before conversion:

clipboard.png

:

clipboard.png

is there any easy way? Consider using function libraries such as lodash,ramda.

Mar.05,2021

this is the problem of the data format itself. Why do you want to return data like this, and why do you change it to the latter format? I think you should first figure out these two questions. Generally speaking, this kind of data has its own logical relationship. If there is a logical relationship, then why do you want to change it? are you unhappy to find it for yourself? Generally speaking, this data format is used in cascading. If there is no logical relationship and is not a cascading type, then you can just ask the back end to return data like this to you.
so I think your project is the wrong place to think, so let's see what the requirements are as soon as possible. There are a lot of unreliable products.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b7f2-2c27e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b7f2-2c27e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?