[SOLVED] How to create a JSON index when there's code in content?

You may get some inspiration/help here:

I think you will get less friction if you first create the object you want to serialize, then use jsonify on that object instead of your manual string manipulations.

This will be better once we get this fixed:

#1853 is too specific, so I don’t think that will get into Hugo master.