|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #76005 Ability to specify indentation string for json_encode with JSON_PRETTY_PRINT
Submitted: 2018-02-24 19:16 UTC Modified: 2018-06-05 11:11 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: cmanley at xs4all dot nl Assigned:
Status: Open Package: JSON related
PHP Version: Next Minor Version OS: all
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-02-24 19:16 UTC] cmanley at xs4all dot nl
The indentation string is currently hard coded as can be seen here:

It'd be nicer for users to be able to specify what they want to use for indentation, e.g. more or less spaces or tabs.

To achieve this, a 4th optional parameter will need to be added to json_encode (as it must not be a global setting), or a built in JSON encoder class can be created in which extra features such as indentation can be set per instance.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-05 11:11 UTC]
-Package: json +Package: JSON related
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Mar 02 17:01:28 2024 UTC