# XML/JSON Serializer

*XML/JSON Serializer* reads hierarchical data and converts it into a text stream. It is basically the conversion of data in structured format to a single stream in a text-like format.

### Sample Use-Case

In this case, we are using an [*XML/JSON File Source*](/dataflows/sources/xml-json-file-source.md)*.*

![](/files/tTgEd2YXh0AWU7tQG1Qt)

The *XML/JSON File Source* contains the hierarchical data of customers, their orders, and the order details.

Right-click on the *XML/JSON File Source* object’s header and select the *Preview Output* to visualize the hierarchical data.

![](/files/LyWD0kOakDvJVjNVbieI)

View the source data from the *Data Preview* window.

![](/files/1t2Hpj5oZY6tDasyKWQf)

Now, to convert this hierarchical data into a single text stream, we will use the *XML/JSON Serializer* object.

### Steps to Use the XML/JSON Serializer

1. Select the *XML/JSON Serializer* object from the Toolbox window and drag-and-drop it onto the dataflow designer.

![](/files/k5huHMYylVM197tLbvYv)

2. Right-click on the *XML/JSON Serializer* object’s header and select *Properties* from the context menu.

![](/files/CBTg7BoIOOjwsE7kezo1)

A configuration window will open, as shown below.

![](/files/0DZvUB2eYQxTJGhCurDW)

3. Provide the *File Path* for the [*XML Schema*](/dataflows/sources/xml-json-file-source.md) i.e., the structure or layout of the XML File.

![](/files/ku0ZbVDmbZpHzqNK7Qbv)

* Check the *JSON Format* option if your file is a JSON.

![](/files/QPu2oEkZmyo2AWxXhOs1)

Click *Next.* This is the *Config Parameters* window, which allows us to configure and define certain parameter for the *XML Serializer Source* file.

Use of Parameters eliminates the process of inserting hardcoded values and provides simplification in the deployment of flows. If the parameters are left empty, the default values defined at the *Properties* window are assigned for use.

![](/files/YP1HqZ6WW5PfDQkXqH0Q)

Now, click *OK*, to proceed further.

4. Map the fields of the *XML/JSON File Source* object onto the *XML/JSON Serializer* object’s fields.

![](/files/QdxDYREdpht1yT5FNtns)

5. Right-click on the object’s header and select *Preview Output*.

![](/files/kpJKAKLh1gMTRqziqdKe)

You can view the data through *Data Preview* window.

![](/files/R08DW2hEr6Ug22hRiysq)

Hover over the *Text* field and you will see the *Serialized* output i.e., stream of text for each hierarchical record of the XML/JSON file.

To store the *Serialized Output,* we must write it to a destination file.

6. Right-click on the *XmlJsonSerializer,* select *Write To,* and select your desired destination object. A destination object is created on the dataflow designer with the *Text* field auto mapped.

![](/files/gOOz62GfkT7n2wGSdl9n)

Here, we have used an [*Excel Workbook Destination*](/dataflows/destinations/excel-workbook-destination.md) object.

7. Right-click on the destination object’s header and provide the *File Path* for the destination file. Select the relevant options and click *OK.*

![](/files/kNOzl5n5qWJCBPRvmJ4c)

By running this dataflow, you can now create an Excel file containing the serialized XML output.

![](/files/jKUH2ZKeTWZj0busLnP4)

This is how an *XML Serializer* Object can be used to format hierarchical data into a single stream of text in Astera.


---

# 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://documentation.astera.com/dataflows/text-processors/xml-json-serializer.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.
