Re: json_encode indent parameter
| From: | Timon de Groot | Date: | Thu, 03 Jun 2021 16:03:42 +0000 |
| Subject: | Re: json_encode indent parameter | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-114716@lists.php.net to get a copy of this message | ||
On 3-6-2021 17:53, Ayesh Karunaratne wrote:
Hi Timon, Thank you for this RFC. I think thestring|int $indentapproach is great 🚀! Reading the PR, it looks like$indent=0is essentially turning off pretty-print, which I think is intuitive. Basically, yes. With$indent=0, no indentation will take place but new lines will still be added.
Do you plan to add any sort of validation on negative integers?
Perhaps throw a \ValueError exception on $indent < 0?
Good question. Personally I'd prefer clamping $indent to 0 when it reaches below 0. But I'd like
to hear about what other particpants think about such behavior.
Thank you for your feedback :).
--
Kind regards,
Timon de Groot