You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Unexpected error when using json_decode

Received Response
18
Views
1
Comments
edited Jun 7, 2022 1:21PM in General Technical Discussions 1 comment

Summary

Fatal error: Out of memory (allocated 400293888) (tried to allocate 51 bytes)

Content

Hello,

    I have encountered a problem when trying to decode a JSON response from an API.

    Using the following code "$result = json_decode($result,true);" throw an error "Fatal error: Out of memory (allocated 400293888) (tried to allocate 51 bytes) ".

    Initially i thought this could be due to the length of the JSON response, but it turned out to be a small JSON response throw an error, Below is the JSON that throw the fatal error when trying toe use Json_decode 

'{ "Results": { "Incident": 12345, "Orders": [ { "OrderNumber": 66899900, "OrderRef": "ABC"}, { "OrderNumber": 512072544, "OrderRef": "JJUUJKI"} ] } }'

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!