rfc:json_encode_indentation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
rfc:json_encode_indentation [2021/06/03 15:23] โ tdgroot | rfc:json_encode_indentation [2022/05/13 07:25] โ Updated the RFC to reflect changes from pull request tdgroot | ||
---|---|---|---|
Line 10: | Line 10: | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | Introducing a 4th parameter, called //indent//. The type of the parameter is string|int and its default value is 4. | + | Introducing a 4th parameter, called //indent//. The type of the parameter is int and its default value is 4. |
- | When a string is passed, that character sequence will be used for indentation, where it normally would be ' | + | By default, an indentation |
- | When an int is passed, an indentation of N spaces will be applied. | + | When the //indent// parameter |
<code php> | <code php> | ||
Line 24: | Line 24: | ||
echo json_encode([' | echo json_encode([' | ||
echo json_encode($data, | echo json_encode($data, | ||
- | echo json_encode([' | ||
- | echo json_encode([' | ||
?> | ?> | ||
Line 39: | Line 37: | ||
2 | 2 | ||
] | ] | ||
- | } | ||
- | { | ||
- | ๐๐" | ||
- | } | ||
- | { | ||
- | " | ||
} | } | ||
</ | </ |
rfc/json_encode_indentation.txt ยท Last modified: 2022/07/19 15:23 by cmb