fixed bug in to-json logic -- was still using older api