JSON in Plugin Settings is wrapped in strings

I’m trying to add a settings page to my Microwave theme so micro.one users are able to customise.

What I’m finding when trying to add a JSON option is that whatever you put in there is wrapped in quotes when added to the config.json.

e.g.

becomes the following in the resulting config.json:

"categoriesFullImgsHome":"[\"Blog\", \"Potato\"]",

Meaning that because it’s a string, it’s not iterable and the theme won’t build.

Manually editing that to:

"categoriesFullImgsHome":["Blog", "Potato"],

gets it working just fine, and is how I’d expect it should sit in config.json.

Am I expecting this to work in the wrong way or is it something you can fix please @manton?

I’m not sure micro.one get customizing themes/plugins generally. That said, yeah, this seems like an error with the JSON field type.

My understanding is they do through having a settings page - so I’m moving everything out of the config.json into plugin.json so it can be administered a little nicer.

As you say though, I’m fairly sure it’s not being handled correctly regardless

To clarify, plug-ins can work in Micro.one, just not full theme editing.

Are you setting the type field to “json” in your plugin.json file? It doesn’t look like this is working. I can fix it, although first I’m going to check if any other existing plug-ins are using this and might break if this changes.

I am setting json there, yep. Appreciate that, thanks @manton