Finish to debug and to implement json writer method