title: How to convert javascript data attributes as array
body: <p>I am trying to develop a library object for slick carousel that passes the parameters in a data object. However I found that data objects can only be a string.  I have found similar posts, but only for string to json.<br>
  Eval or split(",") does not work, btw...</p>
  
  <p>Here is my code:</p>
  
  <p>html:</p>
  
  <pre><code>&lt;div class="carousel container-fluid no-margin" data-params="{dots: true, arrows: true, autoplay: true, autoplaySpeed: 4000}"&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>             var loadCarousel = function(element) {
                      var carousel = $(element).find('.carousel');
                      var params;
                      if($(carousel).find('.single-item').length &amp;&amp; !$(carousel).find('.single-item').hasClass('slick-initialized')) {  
  
                          params =  $(carousel).data('params'); // need to convert from a string to an array
  
                          $(carousel).find('.single-item')          
                              .slick(
                                params 
                              );
  
                      }
  
                  }
  </code></pre>
  
  <p>Thanks!</p>