Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Ability to change json_encode() options #27

Open
anton-kotik opened this issue Sep 19, 2016 · 3 comments
Open

Ability to change json_encode() options #27

anton-kotik opened this issue Sep 19, 2016 · 3 comments

Comments

@anton-kotik
Copy link
Contributor

There is no way to modify json_encode() encode options except JSON_PRETTY_PRINT. For example we can't enable JSON_UNESCAPED_UNICODE or disable default options.

Extending the base class Zend\Json\Json as workaround creates another problems - can't use JsonRenderer with another Json encoder, Zend\Json\Json only:
https://github.com/zendframework/zend-view/blob/master/src/Renderer/JsonRenderer.php#L127-L170

@JohnWhitleyEkkoSense
Copy link

Hi,

Our immediate problem is that we need to pass JSON_FORCE_OBJECT to json_encode. This is because the JSON output an API document that expects an integer-indexed-object, rather an array.

Is there any objection to us adding this functionality and submitting a pull request with it in?

@Ocramius
Copy link
Member

Seems acceptable, although since JSON_THROW flags are now existing directly in core, this component can most likely be removed from your codebase instead...

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-json; a new issue has been opened at laminas/laminas-json#4.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants