I've got a bit of brain fog/freeze at the moment and was looking for some help with an array and converting it on an Excel import.
I have a string in an Excel column which looks like this (these will vary so I can't hardcode it, it needs to be flexible):
name=bob|[email protected]|phone=7859437593
It will be part of a JSON column andI need it to follow this format:
"joined" : "2022-09-01",
"banned" : "0",
"contact_details": {
"name: "bob",
"email": "[email protected]",
"phone": "7859437593"
}
I've exploded the string based on the pipe (|)and then exploded the equals symbol (=) but of course that creates an array for each item:
"contact_details": [
{
"name: "bob",
},
{
"email": "[email protected]",
},
{
"phone": "7859437593"
}
]
How can I create the correctly formed array instead of an array in an array?
Thanks for any help.