title: How can I parse a querystring using liquid template in Azure API-Management set-body?
body: <p>I hope someone sees this and know exactly what to do.  I feel like I tried everything :(.  To give a little background, I'm trying to create a generic rest endpoint to proxy a SOAP reporting service backend and pass the query string keyValues as parameters.</p>
  
  <p>I started down the path using context.Request.OriginalUrl.Query which is: <code>IReadOnlyDictionary&lt;string, string[]&gt;</code> and loop through the keys and values.  This is my preferred method but I was recieving the error: </p>
  
  <blockquote>
    <p>Liquid syntax error: Object '[p_customer_name, System.String[]]' is
    invalid because it is neither a built-in type nor implements
    ILiquidizable</p>
  </blockquote>
  
  <p>Code to produce above:</p>
  
  <pre><code>&lt;v2:listOfParamNameValues&gt;
      {% for parameter in context.Request.OriginalUrl.Query %}
      &lt;v2:item&gt;&lt;v2:name&gt;{{parameter.Key}}&lt;/v2:name&gt;&lt;v2:values&gt;
              {% for value in parameter.Value %}
              &lt;v2:item&gt;{{value}}&lt;/v2:item&gt;
              {% endfor %}
          &lt;/v2:values&gt;&lt;/v2:item&gt;
      {% endfor %}
  &lt;/v2:listOfParamNameValues&gt;
  </code></pre>
  
  <p>I gave up on that and began to parse the QueryString myself just so I could move on but using <code>Split: &amp;amp;</code> or <code>Split: '&amp;amp;'</code> just seem to ignore the &amp; and <code>Split: '&amp;'</code> causes an error:</p>
  
  <blockquote>
    <p>One or more fields contain incorrect values: An error occurred while
    parsing EntityName. Line 15, position 123.</p>
  </blockquote>
  
  <pre><code>&lt;v2:listOfParamNameValues&gt;{% assign parts = context.Request.OriginalUrl.QueryString | Remove-First: '?' | Split:'&amp;amp;' -%}
      {%- for part in parts -%}
          {%- assign keyValues = part | Split:'=' -%}
          {%- for keyValue in keyValues -%}
              {{-keyValue[0]}}:{{keyValue[1]-}}
          {%- endfor -%}
       {%- endfor %}&lt;/v2:listOfParamNameValues&gt;
  </code></pre>
  
  <p>I'm open to any ideas, let me know if there is anything else I can add that may help.</p>
  
  <p>Thank you!</p>