Template Delimiters Configuration


The default delimiters for placeholders and scriptlets in a Simula Template are as follow:

  • ${ and } denote the beginning and end of a placeholder.

  • <% and %> enclose scriptlets.

These delimiters can be changed for a simlet as explained in the next section.

Changing the Delimiters

Here is how to change the default delimiters for placeholders and scriptlets in a Simula template - by using the "delimiters" field:


  from: template
  template: Simula
    # Do not use '<<' or '>>' as delimiters because they are
    # also left and right shift operators, respectively.
    # Also, do not use '{' as left delimiters because that is
    # the beginning of a block in the Groovy scripting language.
    # It can be very confusing to use mustache-style delimiters
    # in JSON body payload...but, yes, it is possible.
    # Configuring Python Jinja-like {% %} delimiters for scriptlets.
      left: "{{"
      right: "}}"
      left: "{%"
      right: "%}"

  status: 200
  - "Content-Type: application/json; charset=UTF-8"

  body: |+
      "queryStringParms": {
        "total": {{ QueryStringParms.count() }},
        "postalCode": "{{ QueryStringParms['postalCode'][0] }}",
        "isDebug": {% if ( {{ QueryStringParms.contain('debug') }} != null ) { %}true{% } else { %}false{% } %}

Change either one of the default delimiters for placeholders and scriptlets, or both. Change only the left or only the right delimiter, or both…​

We would love to hear your feedback! Shoot us an email to [feedback at APISimulator.com] about anything that is on your mind.

Happy API Simulating!