Im surprised with the NULL response, I would have expected some sort of memory limit error. However the issue is you are trying to return too many records from the database, you need to look into pagination and probably change your output code to handle this so your requests can pull additional pages. You can do a search on this forum for the many pagination questions.
On a side note, is there a reason you're JSON encoding a string ?