handling json
drawing segments on canvas