I am trying to passing in JSON into a custom tag
My tag looks like
<b:column span="{xs=12, md=8}">...
When I get around to processing it I want to use:
Myspan = DeserializeJSON(attributes.span);
But it just crashes.
I can use
attributes.span = attributes.span.replacelist('{,=', '{",":');
attributes.span = attributes.span.replace(', ', ', "', "all");
Myspan = DeserializeJSON(attributes.span);
But this looks like a hack
{xs=12, md=8}
is not JSON, just as the error message indicates.
You probably want that to be {"xs": 12, "md": 8}
How are you getting that "JSON" string in the first place? Looks like you might be hand-cranking it - hence it being wrong? If you find yourself hand-crafting JSON strings, you're more than likely going about things wrong, I think. This might be grounds for another S/O question, or perhaps something on codereview..?