# 🐍 Data Post-processing

Source: https://help.airparser.com/post-processing/data-post-processing

The Post-processing step allows you to modify parsed data before exporting it to webhooks, Zapier etc. Write Python code to add custom formatting and business logic: merge or split fields, format dates, prevent some documents from being exported and much more.

Some popular use cases:

- Normalize fields format, reformatting dates or numbers.
- Format data to make an API call without passing by an automated platform (Zapier/Make/Pabbly Connect etc.).
- Create, modify, split, merge or remove some fields.
- Add additional business logic.
- Avoid exporting some documents based on certain condition.

Post-processing is completely optional. It’s an extra step that lets you modify or reshape the parsed data after Airparser extracts it and before it’s sent to integrations (Zapier, Make, webhooks, etc.).

If you don’t have any special formatting needs, you can safely ignore post-processing.

![](https://cdn.eniston.com/bases/539620d4-93af-413a-b051-73249e9322a9/attachments/mceclip0_1695736446.jpg)

Before writing the Python code, it's important to have a basic knowledge of Python and its syntax in order to use this feature efficiently. If you need any help, please don't hesitate to contact our support



## AI code assistant

Don’t want to write Python yourself? Describe the change you want in plain language, and Airparser will draft the code and test it automatically against the document you’re currently viewing.

You’ll find the AI code assistant right below the code editor on the Post-processing page. For example: *"Format all dates as YYYY-MM-DD and keep empty dates blank."*

Airparser writes the code, runs it against your document, and shows the result immediately in the output panel. From there you can keep refining your prompt, or fine-tune the generated code by hand using the Python reference below.

![Shot 2026-09-04 at 15.07.36@2x.jpg](https://cdn.eniston.com/bases/539620d4-93af-413a-b051-73249e9322a9/attachments/1788527286_6a9ac2b6724bc.jpg)

The AI code assistant is available on all paid plans.



## Writing Python Code

The parsed data is stored in the `data` dictionary.



### Available Python libraries

The following Python libraries are available (you don't need to import them):

| [re](https://docs.python.org/3/library/re.html) | Regular expression operations. |
|---|---|
| [decimal](https://docs.python.org/3/library/decimal.html) | Module provides support for fast correctly rounded decimal floating point arithmetic. |
| [datetime](https://docs.python.org/3/library/datetime.html) | Module supplies classes for manipulating dates and times. |
| [dateparser](https://dateparser.readthedocs.io/) | Parses dates in almost any string format. |
| [math](https://docs.python.org/3/library/math.html) | Provides access to mathematical functions. |
| [time](https://docs.python.org/3/library/time.html) | Provides various time-related functions. |

### Python built-in functions

Many Python built-in functions are supported. Here are some of the most useful functions:

| `str(42.99)` | Returns a string object |
|---|---|
| `int("42")` | Returns an integer number |
| `float("42.99")` | Returns a floating point number |
| `range(0, 4)` | Returns a sequence of numbers, starting from 0 and increments by 1 (by default) |
| `len("hello")` | Returns the length of an object |
| `abs(-42.99)` | Returns the absolute value of a number |
| `max([1, -4])` | Returns the largest item in an iterable |
| `min([1, -4])` | Returns the smallest item in an iterable |
| `pow(x, y)` | Returns the value of x to the power of y |
| `filter(function, iterable)` | Construct an iterator from those elements of *iterable* for which *function* returns true. |
| `json_loads(data: str) → dict` | An analog of json.loads() that parses a JSON string and returns a Python dictionary. |
| `json_dumps(obj: dict) → str` | An analog of json.dumps() that converts a Python dictionary into a JSON-formatted string. |

Please refer to the [official documentation](https://docs.python.org/3/library/functions.html) to learn more.

### Python string methods

Here are some of the most useful string methods:

| `"hello".upper()` | Converts a string into upper case |
|---|---|
| `"HELLO".lower()` | Converts a string into lower case |
| `"hello".capitalize()` | Converts the first character to upper case |
| `"hello".endswith('o')` | Returns true if the string ends with the specified value |
| `"hello".startswith('h')` | Returns true if the string starts with the specified value |
| `"  hello  ".strip()` | Removes spaces at the beginning and at the end of the string |
| `"hello world".title()` | Converts the first character of each word to upper case |
| `"hELLO".swapcase()` | Swaps cases, lower case becomes upper case and vice versa |
| `"hello world".split(" ")` | Splits the string at the specified separator, and returns a list |
| `"hello world".replace("hello", "bye")` | Returns a string where a specified value is replaced with a specified value |
| `"42".isdigit()` | Returns True if all characters in the string are digits |
| `"hello".isalpha()` | Returns True if all characters in the string are in the alphabet |
| `"hello42".isalnum()` | Returns True if all characters in the string are alphanumeric |

Please refer to the [official documentation](https://docs.python.org/3/library/stdtypes.html#string-methods) to learn more.

### Limitations

For reasons of security and simplicity, we use a restricted version of Python. Here are some unsupported features:

- import of additional Python packages
- `while` loops
- `print` function
- variables starting with underscore: `_foo = 42`
- Python classes

### Hotkeys

Our code editor supports the following hotkeys:

- `Ctrl+S`: run and save
- `Ctrl+/`: comment out
- `Ctrl+X`: delete line
- `Tab`, `Shift+Tab`: indent and outdent
- `Ctrl+Z`, `Ctrl+Shift+Z`: undo and redo
- `Ctrl+F`: search

Mac users: use the `Cmd` button instead of `Ctrl`.
