# Parse Data Dictionary

This function block extracts a single value from a dictionary provided as text or as a dictionary object. It helps you pick a key from the incoming data and outputs the associated value for use in the rest of your system.

## 📥 Sockets as inputs <a href="#inputs" id="inputs"></a>

`Input Dictionary (String)`\
Provide a JSON-formatted string or an already-parsed dictionary. Example format shown in the UI helps you prepare the input.

## 📤 Sockets as outputs <a href="#outputs" id="outputs"></a>

`Output Data`\
The value corresponding to the key selected in the dropdown. If the selected key is not present or no input is provided, output may be empty.

## 🕹️ Controls <a href="#controls" id="controls"></a>

`Select key from input data dict` Dropdown to pick which key from the incoming dictionary you want to extract.

`Input example / helper text` Informational text showing an example input format (e.g. {"name": "product", "id": 345}) to guide you.

## 🎯 What this block does <a href="#features" id="features"></a>

* Automatically reads incoming JSON-like text or dictionary inputs and exposes the available keys.
* If the available keys change, the dropdown updates so you can select the new key.
* Outputs only the selected value (not the whole dictionary), making it easy to feed single values downstream.

## 📝 How to use <a href="#usage" id="usage"></a>

1. Feed a JSON string or dictionary into the `Input Dictionary (String)` socket.
2. Open the `Select key from input data dict` dropdown and choose the key whose value you need.
3. The chosen value will appear on the `Output Data` socket for other blocks to use.

## ⚙️ Running behavior <a href="#evaluation" id="evaluation"></a>

When the block runs it checks the incoming input. If it is a string representing a dictionary it parses it and lists the top-level keys in the dropdown. When you choose a key the block outputs the associated value on `Output Data`. The dropdown list updates automatically whenever new input presents a different set of keys.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* Use with communication blocks to process incoming messages:
  * Connect `REST API - Get` (use its `Response`) to parse API responses.
  * Connect `MQTT Subscribe` (use its `Data`) to extract fields from incoming messages.
* Use with storage/flow blocks:
  * Feed `Data Read Local` or `Data Read Global` outputs to parse stored dictionaries.
  * Pair with `Data to JSON` when you need to convert structured data into a string first, then parse a specific key here.
* Save or inspect results:
  * Send extracted `Output Data` to `CSV Export` or `Image Logger` (if saving metadata) for logging.
  * Use `Debug Input` to quickly inspect the parsed value during development.
* Validation hint: If you are testing manually, try sending a value from `String Input` to confirm the dropdown populates correctly.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* Nothing appears in the dropdown: make sure the input is a valid JSON string or a dictionary object and that it contains top-level keys.
* Invalid input format: provide JSON-style text (keys and strings with quotes) or a proper dictionary from upstream blocks.
* Selected key yields empty output: confirm that the key exists in the current input dictionary and that you selected the correct dropdown entry.
* Keys change but dropdown does not refresh: feed a new dictionary (or re-evaluate the upstream block) so the block can detect the new key set and update the list.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.augelab.com/function-blocks/data-logic/data-operations/parse-data-dictionary.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
