json_writer: added begin_{object|array}_named and state information