title: How to turn a string in to an array of objects with keys and values in Liquid
body: <p>I'm looking to turn a string that you can be edited in Shopify theme settings into an array of object key values in my Liquid file.</p>
  <p>For example:</p>
  <pre><code>var text = 'key1:value1,key2:value2,anotherKey:anotherValue'
  
  in to:
  
  var array = [{key1: value1}, {key2: value2}, {anotherKey: anotherValue}]
  </code></pre>
  <p>Each object will be separated by a ',' in the string and the key will be to the left of a ':' with the value to the right.</p>
  <p>I need to write this inside a <code>theme.liquid</code> file but unsure how to achieve this. Any help would be most appreciated.</p>
  <p>I've so far only got as far as:</p>
  <pre><code>{% assign text = 'key1:value1,key2:value2,anotherKey:anotherValue' %}
  
  {% assign splitText = text | split: ',' %}
  
  {% assign array = '' | split: '' %}
  {% for data in splitText %}
      {% assign key = data | split: ':' | first %}
      {% assign value = data | split: ':' | last %}
      {% assign array = array | concat: key | append: ':' | concat: value %}
  {% endfor %}
  
  {{ array }}
  
  </code></pre>