This is an old revision of the document!
PHP RFC: is_json
- Version: 0.9
- Date: 2022-08-14
- Author: Juan Carlos Morales, dev.juan.morales@gmail.com
- Status: Draft
- First Published at: http://wiki.php.net/rfc/is_json
Introduction
This RFC introduces a new function called is_json() to validate if an string is a valid json-string.
Fundaments
- Disadvantages of using json_decode or other regex approach. - Reasons for this and projects emulating this with json_decode. - Use existing JSON parser in a more isolated way.
Proposal
This RFC proposes a new function, that returns true if the given string is a valid json-string.
Function description, examples, technical strategy, current JSON parser, etc. ....
Backward Incompatible Changes
None, as this is a new function only.
is_json will no longer be available as a function name, could break potential userland implementations.
Proposed PHP Version(s)
next PHP 8.x
RFC Impact
This RFC has no impact on SAPIs, existing extensions, Opcache, etc.
Open Issues
- No open issues
Future Scope
- (To be defined)
Proposed Voting Choices
- (To be defined)
Implementation
- (To be done later after pushing to github)
References
- (To be done later) -- Links to external references, discussions or RFCs -- Links to major open-source projects emulating this function using json_decode -- Link to Stackoverflow pointing the question, which this proposed function satisfy the needs
Rejected Features
- No rejected features currently.