1

I got following message from the developer:

When the data array is too long, then php function json_encode returns false.

The server uses php 5.6.21, apache 2.2.15. I am not sure there is a server configuration or something that prevents this happening from server side.

1 Answer 1

3

He may mean too deep rather than too long.

The default maximum depth of nested arrays for json_encode is 512. You can override this with the 3rd parameter to json_encode; e.g. $json = json_encode($thing, 0, 1024); to set it to 1024.

Sign up to request clarification or add additional context in comments.

5 Comments

Sorry. Can you tell me where to put that parameter such like php.ini?
I did tell you. It's the 3rd parameter (argument) to the json_encode() function; the last one. The default is 512, if you do not specify a value.
Sorry. I am not an expert on programming so it seems like it should be done in scripts not server configuration. Is that right?
It is a change to the PHP code, where the json_encode() function is being called. This is not expert level, it's basic. The developer you mentioned should be able to fix it, if you can't.
They said their script doesn't have a depth more than 5 so it's not a valid point to extend to 1024. What else I should look at from server side?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.