There is a JavaScript object in the following format:
{
"draw": "",
"columns": [
{
"data": "userid",
"name": "",
"searchable": true,
"search": {
"value": "",
"regex": false
}
}
]
}
I want to transform it into a single-dimensional object like this:
{
"draw" : "",
"columns[data]": "userid",
"columns[name]": "",
"columns[searchable]": "true",
"columns[searchable][value]": "",
"columns[searchable][regex]":"true"
}
The main object can have multiple layers of depth and may contain objects and arrays.
Any suggestions or ideas are greatly appreciated since JavaScript is not my strong suit.