Convert HTML to a JSON tree