Js assembling data (urgent problem)

const citys = {
"Zhejiang": ["Hangzhou 1Qing," Ningbo", "Wenzhou", "Jiaxing", "Huzhou"],
"Fujian": ["Fuzhou", "Xiamen", "Putian", "Sanming", "Quanzhou"],
"Fujian 1Qing: [" Fuzhou 1Qing, "Xiamen 1qu," Putian 1Qing, "Sanming 1"," Quanzhou 1"]
}

how to assemble js into the above format -sharp-sharp-sharp problem description

Apr.20,2022

well, I'm not very clear. What's the format of your data source?
are you asking how to become a json string? It would be nice to just json.stringify.
Let's make the requirements clear, otherwise people can't help you even if they want to.


you need such a piece of data. I guess it should be to implement a multi-level linkage selection box, or to format and pass the selected results to the backend
. Usually, for such a problem, the solution is to maintain a set of "key-value" relational tables, such as

.
const data = [
    {
        'key': 'zj',
        'value': '',
        'city': [
            {'key': 'hz', 'value':'', 'county': [{'key': 'county1', 'value': 'name1'}]}
            ...
        ]
    }
    ...
]

normally, front-end projects are constructed into MVC mode. In M and C, the value of 'key'' is usually used for business processing of data, while the value of 'name' is used in V, that is, it is only used for page display.
then, different transformations or processes are made depending on the business requirements.

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-1e54185-45298.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-1e54185-45298.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?