Welcome to our newly overhauled Zephyr pages! See our new Overview, Examples, and Index.
Feedback is welcome at bottom of each page.


Returns values of an object.

list values( object input )

Returns a list of values for each property that exists on the inputobject.


{values(obj)}   ---> ["Hello","World"]

Show the Temperature from Various Cities from a Data Feed

Use Case: You have a data feed of various areas and current temperature. The location is being stored as a key, and the temperature is being stored as a value. In order to populate it in a template to be reader-friendly, you’ll need to use both keys() and values() to properly display them.


Feed content:

{"weather": [
{"url": "","vars": {"city": {"New York": "57"}}},
{"url": "","vars": {"city": {"Los Angeles": "68"}}},
{"url": "","vars": {"city": {"London": "36"}}}]}

In the Setup:


{areas = []}
{degrees = []}
{foreach weather as c}
{areas = areas + keys(}
{degrees = degrees + values(}


In the template:


{foreach areas as i,k}
The weather in {k} is {degrees[i]} degrees.<br/>


The weather in New York, NY is 57 degrees.
The weather in Los Angeles, CA is 68 degrees.
The weather in London, GB is 36 degrees.
The weather in Austin, MA is 76 degrees.


This script is referencing a unique data feed with a content array “weather.” Within this array, there is a subset of content variables called “city”, whose value is the key/value pairing of a city name and the current weather in degrees Fahrenheit — for instance, “New York, NY” (key) and “57” (value). Within the script, two empty arrays are created: an “areas” array and a “degrees” array. Using a foreach loop, the “weather” content array is looped through, and, using the keys() function, the value for “areas” becomes a list of all of the “keys” of the “city” variable. In the example of this feed, the areas array equates to [‘New York’, ‘Los Angeles’,’London’]. Similarly, the same loop also uses the values() function to find each value of the “city” variable. Each value then gets added to the degrees array. In this instance, “degrees” becomes [’57’,’68’,’36’].

Finally, in the template, another loop is done on the “areas” array, finding the index (i) and the key (k). The loop iterates through each item in the “areas” array and outputs the city name. Using the index (i.e., its numerical position in the array), the “degrees” array is referenced to pull in whatever value is in that position. For instance, in the first iteration of the loop, i = 0 and k = New York, which dynamically populates as “The weather in New York is {degrees[0]} degrees.” Since “57” is in the first position of the “degrees” array (i.e. degrees[0]), the final output is “The weather in New York is 57 degrees.” This loop then continues for the rest of the array.