Changed api output to use custom json writing.