|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
20 - 2 = ?
Subscribe to this entry?

 [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-2019 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 07:01:26 2019 UTC