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.

Menu