rfc:is_json

This is an old revision of the document!


PHP RFC: is_json() function

This is a suggested template for PHP Request for Comments (RFCs). Change this template to suit your RFC. Not all RFCs need to be tightly specified. Not all RFCs need all the sections below. Read https://wiki.php.net/rfc/howto carefully!

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.

rfc/is_json.1660514798.txt.gz · Last modified: 2022/08/14 22:06 by juan_morales