replaced fprintfs with context printf function
added new method json_count_characters