> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Return structured data in FQL

You can use [Flows Query Language](/flows/flows-query-language/introduction-to-fql/) (FQL) to transform one JSON object into another, differently structured, JSON object. This topic provides example FQL expressions that show different ways of structuring the JSON output of an **Evaluate** block in Postman Flows.

To try out the examples, add a [Record](/flows/reference/blocks/record/) input to the **Start** block in your flow. Connect an **Evaluate** block to the **Start** block. In the **Evaluate** block's dropdown menu, select FQL. Paste an example FQL expression into the **Evaluate** block. Then create a scenario and paste the following example JSON into the scenario field that corresponds to your **Start** block's input.

<summary>
   Click to view example JSON 
</summary>

```json
{
    "name": "John Smith",
    "physical_address": {
        "street": "123 Park Avenue",
        "city": "Atlanta",
        "state": "GA",
        "zip": "12345"
    },
    "work_address": {
        "street": "583 W. Island Drive",
        "city": "Miami",
        "state": "FL",
        "zip": "44456"
    },
    "mailing_address": {
        "street": "232 Ravensburg Road",
        "city": "Durham",
        "state": "NC",
        "zip": "03948"
    },
    "phones": [
        {
            "type": "Home",
            "number": "123-456-7890"
        },
        {
            "type": "Cell",
            "number": "098-765-4321"
        },
        {
            "type": "Cell",
            "number": "888-777-5555"
        },
        {
            "type": "work",
            "number": "314-265-9078"
        }
    ]
}
```

When you run the flow, the expression will operate on the example JSON and the **Evaluate** block will output the result.

## Return multiple objects as an array

To return an array containing three of the top-level objects in the example JSON, use the following expression:

```json
    value1.[physical_address, work_address, mailing_address]
```

<table class="code-ref-table">
  <tbody>
    <tr>
      <td>
        Expected result
      </td>

      <td>
        ```json
        [
            {"street": "123 Park Avenue","city": "Atlanta","state": "GA","zip": "12345"},
            {"street": "583 W. Island Drive","city": "Miami","state": "FL","zip": "44456" },
            {"street": "232 Ravensburg Road","city": "Durham","state": "NC","zip": "03948"}
        ]
        ```
      </td>
    </tr>
  </tbody>
</table>

## Return an array of a single field from multiple objects

To return an array containing only the values of the `city` key from the three top-level `address` objects in the example JSON, use the following expression:

```json
    value1.[physical_address, work_address, mailing_address].city
```

<table class="code-ref-table">
  <tbody>
    <tr>
      <td>
        Expected result
      </td>

      <td>
        ```json
        ["Atlanta","Miami","Durham"]
        ```
      </td>
    </tr>
  </tbody>
</table>

## Collapse multiple objects into a single key-value pair

FQL can return an array of key-value pairs composed of values from an object. To get the values of the `type` and `number` keys from objects in the `phones` array and return them as an array of key-value pairs, use the following expression:

```json
    value1.phones.{type: number}
```

<table class="code-ref-table">
  <tbody>
    <tr>
      <td>
        Expected result
      </td>

      <td>
        ```json
        [
            {"Home": "123-456-7890"},
            {"Cell": "098-765-4321"},
            {"Cell": "888-777-5555"},
            {"work": "314-265-9078"}
        ]
        ```
      </td>
    </tr>
  </tbody>
</table>

## Collapse and group results by a shared field value

FQL can return an array that groups the values of a given key that's present in multiple input objects. To group the values of `Cell` keys from two different objects in the `phones` array, use the following expression:

```json
    value1.phones{type: number[]}
```

<table class="code-ref-table">
  <tbody>
    <tr>
      <td>
        Expected result
      </td>

      <td>
        ```json
        {
            "Home": ["123-456-7890"],
            "Cell": ["098-765-4321","888-777-5555"],
            "work": ["314-265-9078"]
        }
        ```
      </td>
    </tr>
  </tbody>
</table>