Your question gives the impression that the OOM is occurring writing out data. Perhaps by attempting to write an entire recordset. Instead you probably need to write an algorithm that iterates through pages of data - SQL Server's ROW_NUMBER(ORDER BY x, y, z) is the right approach for this. You could then write out several files or use fileWrite(fileObj, data) to create one large file - the latter you probably need to do a format other than JSON, such as CSV.
Now if the issue is on data insert, there is a bug with ColdFusion and looping over SQL statements. Basically you need to put the <cfquery>INSERT...</cfquery>
inside <cfthread/>
when looping repeatedly.
Finally, if you're running into issues reading the data from a file you need to do buffered reads . In this case you'll either need to use CSV as your serialization format or use a SAX XML parser, if you use XML, but I am unaware of a JSON parser that reads in a buffered fashion.