Custom rest api endpoint response json problem

Turn out it is caused by a BOM character from one of my included file. If you are having same problem, you can save your file to Encode in UTF8 without BOM.