php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cmanley at xs4all dot nl
New email:
PHP Version: OS:

 

 [2018-02-24 19:16 UTC] cmanley at xs4all dot nl
Description:
------------
The indentation string is currently hard coded as can be seen here:
https://github.com/php/php-src/blob/master/ext/json/json_encoder.c#L86

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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-05 11:11 UTC] bukka@php.net
-Package: json +Package: JSON related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 06:01:32 2024 UTC