distantnative / retour-for-kirby

Kirby CMS plugin to manage redirects and track 404s right from the Panel
https://distantnative.com/retour-for-kirby/
MIT License
135 stars 15 forks source link

Format JSON for config file (pretty-print) #284

Closed nilshoerrmann closed 1 year ago

nilshoerrmann commented 2 years ago

When storing redirects as JSON in retour.json, updating routes from the panel UI remove all formatting. Storing the JSON with pretty formatting (line-breaks, indentations) would help reading the content in an external editor.

distantnative commented 2 years ago

I'll consider this for a later point in time. Right now using Kirby's Data class which automatically switches between JSON and YAML writing depending on file extension, but doesn't offer an easy way to activate pretty-printing of JSON.

distantnative commented 1 year ago

I had another look at this, but with using the core Data classes, I have no influence on the formatting that the file is written. However, you could save it as PHP instead of JSON, then it gets written quite nicely formatted.