# Proposal: new implentation of JSON extension.

- Thread: https://externals.io/message/67303
- Original archive: https://news-web.php.net/php.internals/67303
- Started by Remi Collet on 2013-05-04T15:19:55+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #67303 — Remi Collet — 2013-05-04T15:19:55+00:00

URL: https://externals.io/message/67303#67303

Raise again this discussion as no feedback on pecl ML.

Trying to solve https://bugs.php.net/bug.php?id=63520

I start to work on a dropin alternative for current json extension in php.


Current work:
https://github.com/remicollet/pecl-json-c


It is obviously to late for PHP 5.5, and need probably more feedback,
more tests, and more work before a RFC for PHP 5.6 (or later).

* json_encode : same code than php 5.5, no difference

* json_decode : wrapper over json-c 0.11 library.

Difference:
- error code returned by the parser are different (so only
PHP_JSON_ERROR_SYNTAX and PHP_JSON_ERROR_DEPTH are used)
- number only parse as integer (no automatic cast to double)
- loose of performance (but still acceptable, I think)

New feature: as json-c is an incremental parser, a new class is
available to allow incremental parsing (for large json encoded data)



Proposal:

1/	update existing pecl/json extension

	- on pecl for older PHP 5.3 - 5.5
	- on php-src in master / 5.6

OR

2/	new pecl/json-c extension

	- PHP will keep the non free code


Should I open a RFC ?


Regards,
Remi.


P.S. I have tried to contact Omar, original author of this extension,
without any success.
