If you are not afraid of a little java (~ 100 loc), you can pass your query (coldfusion.sql.QueryTable - do a google search) to the java class and let Jackson convert it to json for you. It is very fast and keeps your data types the same as your databases. Therefore, if you have varchar with 0 as the value, you will get "0" back. If you have an int, you get an int. Null is zeros, and empty lines are empty lines (although you can override this if you want). It is totally worth using java to get around all these CF json issues.
source share