How to remove ALL unnecessary spaces from a JSON string (in PHP)?
I assume that I need to use preg_replace with some clever regex so as NOT to touch spaces that are part of the values.
A simple example would be:
Before: '{"key": "value with spaces for support"}'
After: '{"key": "value with spaces for support"}'
Basically, I'm looking for a way to minimize and pack a string as tight as possible without changing any data.
source share