clean up json handling