tghounsell
Member
I have a multi-select field called services. Here's a sample value:
["Cut Lawn","Trim Hedge"]
Now I want to combine it with a date field to come up with a field that reads:
Cut lawn, Trim Hedge - 2022-11-01
First, I need a clean version of this text, and that's where I get into trouble.
$blurb = json_decode('["Cut Lawn","Trim Hedge"]') //this works fine, as a hardcoded test string, yet...
$blurb = json_decode('{jobs___services}') //comes out null
$blurb = json_decode('{jobs___services_raw}') //comes out null
So I thought to take a longer approach and just cut the offending characters from the string. Easy enough for the square brackets, but nothing seems to work for the quotes.
return str_replace('"','', '{jobs___services}'); //comes out unchanged from the original
return str_replace('\"','', '{jobs___services}'). //escaping the character doesn't help.
What's going on?
["Cut Lawn","Trim Hedge"]
Now I want to combine it with a date field to come up with a field that reads:
Cut lawn, Trim Hedge - 2022-11-01
First, I need a clean version of this text, and that's where I get into trouble.
$blurb = json_decode('["Cut Lawn","Trim Hedge"]') //this works fine, as a hardcoded test string, yet...
$blurb = json_decode('{jobs___services}') //comes out null
$blurb = json_decode('{jobs___services_raw}') //comes out null
So I thought to take a longer approach and just cut the offending characters from the string. Easy enough for the square brackets, but nothing seems to work for the quotes.
return str_replace('"','', '{jobs___services}'); //comes out unchanged from the original
return str_replace('\"','', '{jobs___services}'). //escaping the character doesn't help.
What's going on?