Fix JSON encode error and add main route page render