Locoia
  • Overview
  • Account and User Settings
    • User types
    • Adding Users
    • Teams
    • Access Permissions
    • 2 Factor Authentication 2FA
    • Versioning and Snapshots
    • Activity Log
  • Reset your Password
  • Invoices and Payments
  • Automation
    • Flow Builder
      • Flow Building Best Practices
      • Jinja Template Language
        • Jinja: (Custom) variables, wildcards and functions
        • Magic Code Samples
      • Connectors & APIs
        • Titles and References
        • Referencing data of objects, lists, arrays - how to pass data dynamically
        • Accessing Objects with JSONPath
        • Merging nested JSON objects
        • Parsing JSONs from String
        • Response Headers & Status Codes
        • Custom Data Fields
        • Wildcard API calls and actions
        • Response cleaning
      • Text Strings, Date & Time, Numbers and Currencies
        • Text and Strings
        • Dates & Time
        • Numbers (Thousand Separators, Currencies)
      • Email-formatting
      • Code Fields
      • Running single Flow steps
      • Flow run data retention, logging, and error notifications
      • Advanced View
      • Dynamic Title
      • Custom Error Handling
      • Error Handling Flows
      • Automatic Pagination
    • Flow Debugger
      • Automatic Retrying
      • Run Flows again
      • Troubleshooting Flows
    • Community Library
  • Connectors & Helpers
    • Connectors
      • Monday.com
      • ActiveCampaign
      • Aircall
      • Allthings
      • Amplitude
      • Animus
      • Assetti
      • Awork
      • AWS RDS Database - How to connect
      • bubble.io
      • Casavi
      • Chargebee
      • CleverReach
      • comgy
      • commercetools
      • Everreal
      • Exact Online
      • Facebook Marketing
      • Fahrländer Partner
      • FastBill
      • FILESTAGE.io
      • Freshdesk
      • Freshsales
      • Google Ads
      • Google Ads Lead Form
      • Google Analytics
      • Google Chat
      • Google Drive
      • Google Sheets
      • Gmail
      • HubSpot
      • Heyflow
      • iDWELL
      • ImmobilienScout24
      • Instagram Ads
      • Intercom
      • klaviyo
      • Kiwi Opening Doors
      • Klenty
      • Klipfolio
      • Kolibri CRM
      • konfipay
      • KUGU
      • Shopify
      • S3 AWS
      • SQS AWS
      • Lambda AWS
      • Learnster
      • lexoffice
      • LineMetrics
      • Linkedin
      • Locoia
      • Notion
      • MailGun
      • Makula
      • Microsoft Dynamics 365
      • Microsoft OneDrive
      • MixPanel
      • MongoDB
      • Odoo
      • OnFleet
      • OnOffice
      • Oracle NetSuite
      • Outbrain
      • Quickbooks
      • Trello
      • PandaDoc
      • Personio
      • Pinterest Ads
      • Pipedrive
      • Plentific
      • PriceHubble
      • relay
      • REALCUBE
      • Sage ERP
      • Salesforce
      • SAP
      • Scoro
      • Seafile
      • sevDesk
      • SharePoint
      • SharpSpring
      • Slack
      • Snapchat Marketing
      • Snowflake
      • Teamleader Focus
      • Teamwork.com
      • Tableau
      • TikTok
      • TinQwise
      • The Trade Desk
      • Twitter
      • Typeform
      • WordPress
      • Xero
      • Youtube
      • Zendesk
      • Zoho CRM
      • Zoom
    • Helpers
      • Scheduler
      • Webhook
      • Dict Helper
      • Spreadsheet Helper
      • REST Helper
      • Boolean Helper
      • Multi Case Helper
      • Looper
      • FTP Helper
      • CSV Helper
      • XLSX Helper
      • Mail Sender
      • Flow Trigger
      • File Storage Helper
      • Terminate Helper
      • Delay Helper
      • SQL Connector
      • PDF Helper
      • Zip Helper
      • Data Warehouse Helper
      • XML Helper
      • Form Helper
      • Arrow
      • Error Arrow
    • Authentication Types Available
      • Setting up authentication
      • OAuth1
      • OAuth2
      • Refreshable token
      • AWS Signature
      • Basic Auth and Other Simple Authentication Methods
      • How are API versioning and API updates handeled?
      • Custom OAuth2 clients (apps)
    • Building Connectors
      • Base Connector Setup
        • Connector Auth Validation
        • GraphQL APIs
        • Rendering with User Input
      • Building Connector Actions
        • Actions Examples
      • Search Automation
      • Pagination Automation
      • Uploading Files in Actions
      • Working with SOAP APIs
    • Super Actions
    • Webhook Trigger for Connectors
    • Data Mapping and Env Variables
  • Embed - White Label Portal
    • Embed Overview
      • 1. Embed Flow
        • 1.1 Creating Embed Flows
        • 1.2 Updating Embed Flows
        • 1.3 Embed Error Handling
        • 1.4 Setting up Callbacks for Integration activation/deactivation
        • 1.5 Setting up Remote search
        • 1.6 Setting up End User logs
      • 2. Configure Embed
        • 2.1 Embed Integration via SSO
        • 2.2 Proprietary connector setup
        • 2.3 Sharing level
        • 2.4 Consent screen
        • 2.5 Account Secrets
        • 2.7 Further settings
      • 3. Integrate Embed
        • 3.1 iframe vs native embed
        • 3.2 Customizing CSS
        • 3.3 Events emitted from iframe to parent window
      • 4. Embed for End User
        • 4.1 Embed Remote Search
        • 4.2 Embed End User Logs
      • 5. Test Embed Configuration
        • Testing example
      • 6. Embed Integrations and Connector Auths
    • Embed FAQs
  • Data and Dashboards
    • Dashboards & Insights
      • Introduction to Dashboards
      • Introduction to Insights
      • Introduction to Data Sources
      • Dashboard Filters
      • Insight Marketplace - Using Pre-Built Insights
      • Writing SQL Queries
      • Useful SQL Examples
      • Charts
        • Line Chart
        • Bar and Horizontal Bar Chart
        • Stat Card
        • Pie Chart
        • Gauge Chart
        • Donut Chart
        • Stacked Bar, Horizontal Stacked Bar, and Normalized Horizontal Stacked Bar
        • Multiple Line Chart
        • Pivot Table
        • Map Chart
  • Best Practice Guides
    • Integration Best Practices
    • Integration Check List
    • CSV Files in Excel
    • Multi-Tenant Flows
    • On-Premise Integrations
    • Database Connection Setup
    • Data and General Security
    • Using Tags
    • FAQ
  • API
    • Locoia API Authentication - Personal Access Token
    • Create Connector Authentication
  • Contact us
  • Status of Service
  • Data Privacy
  • Imprint
Powered by GitBook
On this page
  • Overview
  • What is essential for you to understand
  • 1. Dictionaries (Dict)
  • 2. Lists
  • 3. Jinja expressions
  • Actions
  • 1. Define variables for later use
  • 2. Filter List V2
  • 3. Remove list from lists (flatten list)
  • 4. Store Value
  • 5. Add string to the dictionary
  • 6. Add string to list
  • 7. Replacing fields in lists or dictionaries
  • 8. Update value
  • 9. Append Value
  • 10. Combine Lists
  • 11. Convert List Of Dicts To List Of Lists
  • 12. Filtering

Was this helpful?

  1. Connectors & Helpers
  2. Helpers

Dict Helper

Replace, add or filter for dictionaries or lists a.k.a. JSON objects

PreviousWebhookNextSpreadsheet Helper

Last updated 4 months ago

Was this helpful?

Overview

Dict Helper is not only one of the most popular tools, but it is also a powerful tool for Flow. It is capable of storing values, filtering them, parsing , and much more.

What is essential for you to understand

1. Dictionaries (Dict)

A dictionary is a structure that is essentially a list of key: value pairs.

Example
{
  "name": "John Doe",
  "age": 23,
  "address": {
    "street": "123 Main Street, Boston",
  }
}

2. Lists

A list, similar to an array, is a versatile data structure designed for storing collections of items. Lists can accommodate a wide range of data types, including:

  • Numbers (both floating-point and integers)

  • Strings

  • Nested lists

  • Dictionaries

This flexibility makes lists a fundamental tool for managing and organizing various types of data."

Example
[
  {"name": "John", "age": 23},
  {"name": "Bob", "age": 25},
  {"name": "Charlie", "age": 35}
]

3. Jinja expressions

Actions

1. Define variables for later use

This action has only one input that accepts dictionaries, lists, and Jinja expressions. It allows you to reference data from Previous Steps, File Uploads, and Environment Variables within your workflow, enabling you to execute custom logic. In this example, the variable contacts comes from a previous step:

Example
{% if contacts | length < 100 %}
  "this is fine"
{% else %}
  "too much"
{% endif %}

2. Filter List V2

The enhanced version of the Filter makes it effortless to apply filtering in a no/low-code manner. Filtering is carried out using a variety of predefined filter operators tailored to different data types. Some of them:

  • Exists

  • Equal to

  • Greater than

  • Less than

  • Contains

  • Is empty

3. Remove list from lists (flatten list)

  • Nested lists

  • Dictionaries

For instance: if you have a list like

Example of list of lists
[
  [1,2,3],
  [4,5,6],
  [7,8,9]
] 

you get [1, 2, 3, 4, 5, 6, 7, 8, 9] back.

4. Store Value

Add any kind of value to a dictionary

5. Add string to the dictionary

This feature enables you to append a new field with a specified value to an existing dictionary. For instance, if you have a Zendesk user object containing first_name and last_name, you can easily include the age by specifying both the Field name and the desired Content:

6. Add string to list

It allows you to add a new string to an existing list.

7. Replacing fields in lists or dictionaries

With this action, you can replace a value in the specified place.

For example, you have a user (zend1.user):

{
   "user":{
      "first_name": "Max",
      "last_name": "Miller",
      "email": "max.miller@mac.com"
   }
}

And you want to replace the value of the field first_name in the JSON / dictionary response of Zendesk with my_new_name:

After replacing:

{ 
  "user": {
    "first_name": "my_new_name",
    "last_name": "Miller",
    "email": "max.miller@mac.com"
    }
}

Replace a value in the list: Similarly to the previous example you need to specify the destination - index to access n element in the list. So to replace the user's email here you need to enter it's index [2]

[
  "Max",
  "Miller",
  "max.miller@mac.com"
]

8. Update value

Update any kind of value in a dictionary

9. Append Value

This is very similar to #6.-add-string-to-listbut more powerful It allows you to add an entire row or object to a list.

10. Combine Lists

This helps you to unite two lists in one

Example:

list_1
[
  "Barcelona",
  "Berlin"
]
list_2
[
  "Porto",
  "Kyiv"
]

will be united into

list_combined
[
  "Barcelona",
  "Berlin"
  "Porto",
  "Kyiv"
]

11. Convert List Of Dicts To List Of Lists

Converts list of dicts (JSON objects):

list of dicts
[
   {
      "email": "miller@gmail.com",
      "last_name": "Miller",
      "first_name": "Max"
   },
   {
      "email": "peter@mac.com",
      "last_name": "Zoal",
      "first_name": "Peter"
   }
]

to list of lists:

list of lists
[
  [
    "miller@gmail.com",
    "Miller",
    "Max"
  ],
  [
    "peter@mac.com",
    "Zoal",
    "Petr"
  ]
]

12. Filtering

You can also use the Jinja filter selectattr to filter without having to use an action.

Filtering a list

Filtering a JSON / dictionary (dict)

As an example, let's say you want to filter a list of Freshdesk or Zendesk tickets. The response JSON of an API would look like this:

{
   "tickets": [
      {ticket1 ... some more JSON},
      {ticket2 ... some more JSON},
      {ticket3 ... some more JSON}
   ...
   ]
}

The corresponding connector setup looks like this:

As a list reference in this case, you would provide zen1.tickets in order to only get the list of tickets, because as you can see, within the above JSON object is again a list, indicated by the squared brackets [ ]. So essentially, you could say the above is a JSON object that wraps a list of ticket objects, which are again JSON.

If you want to filter for a particular data record e.g. after pulling all your Zendesk tickets, you want to get all tickets where the requester_id is 12345, you could filter for:

item.requester_id == 12345

An alternative notation which would yield the same result would be HTML

12345 in item.tags

More examples:

"email" in item.profile and item.deleted == False and item.updated >= (unix_timestamp - 3* 24 * 60 * 60)
item.created_date > "{{ convert_datetime(date, '%Y-%m-%d', -30) }}" and item.status == "active" and item.email[-10:] != "locoia.com"

Note that you cannot use the item parameter in combination with Jinja, here need you to use Python instead.

, essentially JSON objects adapted for efficient program communication, along with , constitute the most commonly employed methods for transferring data between programs and bridging the gap between browsers and servers.

Jinja is a powerful templating engine designed for Python. It seamlessly integrates with Dict Helper, allowing you to effortlessly execute logic by passing Jinja expressions directly. You can learn more

Replacing fields in dictionaries

For a large list, larger than 50k entries or 5 MB, please use the , as it can better handle large data.

will most likely be used a lot for CSV files or e.g. GoogleSheet content that is a list of lists. Please see the section here on .

More info
More info
here
More details can be found here.
Dictionaries
lists
Jinja expressions
Spreadsheet helper with action Query spreadsheet
filtering CSVs here