Serialize HTML tables into JSON in Ruby