[format] initial support for json formats and some bug fixes