# A patch for bug 44331

- Thread: https://externals.io/message/46384
- Original archive: https://news-web.php.net/php.internals/46384
- Started by Florian Anderiasch on 2009-12-09T21:54:46+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #46384 — Florian Anderiasch — 2009-12-09T21:54:46+00:00

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

Hi there,
I've tried to come up with a solution for

Formatting option for json_encode
http://bugs.php.net/bug.php?id=44331

Any comments are highly welcome :)

the patch is against the PHP_5_3 branch as HEAD changes quite some
unicode stuff.

Greetings,
Florian

---

## #46385 — Scott MacVicar — 2009-12-09T21:58:39+00:00

URL: https://externals.io/message/46384#46385 · In reply to: #46384

The JSON API is exported and can't change it as it breaks the ABI. I know the memcached extension uses this.

I'll look into adding something similar this week, thanks for the patch.

S



> <bug_44331.patch

---

## #46386 — Scott MacVicar — 2009-12-09T22:06:22+00:00

URL: https://externals.io/message/46384#46386 · In reply to: #46385

Ignore me, it's fine and I'll apply it soon.

S




> The JSON API is exported and can't change it as it breaks the ABI. I know the memcached extension uses this.
> 
> I'll look into adding something similar this week, thanks for the patch.
> 
> S
> 
> 
> 
> > […]

---

## #46387 — johannes@php.net — 2009-12-09T22:17:38+00:00

URL: https://externals.io/message/46384#46387 · In reply to: #46384

> 
> --- ext/json/json.c.orig        2009-12-09 22:15:33.000000000 +0100
> +++ ext/json/json.c     2009-12-09 22:48:04.000000000 +0100
> @@ -42,6 +42,7 @@
>  #define PHP_JSON_HEX_APOS      (1<<2)
>  #define PHP_JSON_HEX_QUOT      (1<<3)
>  #define PHP_JSON_FORCE_OBJECT  (1<<4)
> +#define PHP_JSON_FORMAT_OUTPUT (1<<5) 

btw. they should be move to a header as we're exporting the API
depending on the.

johannes
