[php-src] Issue #8864: JSON pretty printing indentation using tabs or double spaces
| From: | timint | Date: | Sat, 25 Jun 2022 00:04:20 +0000 |
| Subject: | [php-src] Issue #8864: JSON pretty printing indentation using tabs or double spaces | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241804@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8864
Author: timint
### Description
The current indentation of pretty printed JSON with json_encode() is using 4 bytes per level.
I feel we are lacking the ability to choose intendation type, i.e. for optimization.
Example:
* Tab (1 bytes)
* Two spaces (2 bytes)
* Four spaces (4 bytes)
Maybe by setting a flag to either:
JSON_PRETTY_PRINT
JSON_PRETTY_PRINT_TABS
JSON_PRETTY_PRINT_DOUBLE_SPACES
I know that I can preg_replace() it the way I want. But why waste resources if we could have it at
the core.