# XML/JSON File Source

Adding an *XML/JSON File Source* object to a dataflow allows you to read and transfer data from an XML or a JSON file.

{% embed url="<https://youtu.be/mWdoPPFjO0c>" %}

## **Getting XML/JSON Source Object**

1. To get an *XML/JSON File Source* from the *Toolbox*, go to *Toolbox > Sources > XML/JSON File Source*. If you are unable to see the Toolbox, go to *View > Toolbox* or press Ctrl + Alt + X.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FX6SexkIOVtH3MpaMQjR4%2Fimage.png?alt=media&#x26;token=041c5f69-48f3-4546-bcd0-089109606e62" alt=""><figcaption></figcaption></figure>

2. Drag and drop the *XML/JSON File Source* object onto the designer.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FKzZaObYl4DgOIr6xDHMm%2Fimage.png?alt=media&#x26;token=5a8973cd-c69c-4cdb-b7ac-67329fad3714" alt=""><figcaption></figcaption></figure>

You can see that the dragged source object is empty right now. This is because we have not configured the object yet.

## **Configuring the XML/JSON File Source Object**

1. To configure the *XML/JSON File Source* object, right-click on the header and select *Properties* from the context menu.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FFAGcc1wD28UUxKCPdlDY%2Fimage.png?alt=media&#x26;token=854c2f39-3961-4819-98f3-7fb7c0a42aff" alt=""><figcaption></figcaption></figure>

When you select the *Properties* option from the context menu, a dialog box will open.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FCl4xUe5o50kJnKLYoP2z%2Fimage.png?alt=media&#x26;token=df67c437-5cf0-40d4-b0e8-dfdf7607580c" alt=""><figcaption></figcaption></figure>

This is where you can configure properties for the *XML/JSON File Source* object.

2. The first step is to provide the *File Path* and *Schema Location* for the *XML/JSON Source* object. By providing the file path and schema, you are building the connectivity to the source dataset.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FXymbfDGJU2iumdACT9AB%2Fimage.png?alt=media&#x26;token=605d00bf-2fcb-4f90-bdd9-a96de84b55e6" alt=""><figcaption></figcaption></figure>

* Check the *JSON Format* checkbox if your source file is a JSON.
* Check the *Provide Inner XML* checkbox to get the XML markup representing only the child nodes of the parent node.

{% hint style="info" %}
**Note**: In this case, we are going to be using an XML/JSON file with *Orders* sample data in the parent node and *Order Details* sample data in the child node.
{% endhint %}

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2Fi2RzludsBVmPwv9mDGtC%2Fimage.png?alt=media&#x26;token=fd7f5dc5-8873-42d5-8cb2-29a44cccb359" alt=""><figcaption></figcaption></figure>

3. Once you have specified the data reading options in this window, click *Next*.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F6iKBqmYCE8iBUenu9DxQ%2Fimage.png?alt=media&#x26;token=725320e3-91aa-4275-9b35-6ddf609ce983" alt=""><figcaption></figcaption></figure>

On the *XML Layout* window, you can view the layout of your XML/JSON source file.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FA6t4ZlIXotlninmT5B7w%2Fimage.png?alt=media&#x26;token=ff4442c0-5242-4847-b665-317b86b27a95" alt=""><figcaption></figcaption></figure>

4. After you are done viewing the layout, click *Next*. You will be taken to a new window, *Config Parameters*. Here, you can define the parameters for the *XML/JSON File Source*.

Parameters can provide easier deployment of flows by eliminating hardcoded values and provide an easier way of changing multiple configurations with a simple value change.

{% hint style="info" %}
**Note**: Parameters left blank will use their default values assigned on the properties page.
{% endhint %}

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F2cZ9eIlp1ETy0ojjUvHi%2Fimage.png?alt=media&#x26;token=c5c43e40-82c1-4041-b017-8dcf141a7ee0" alt=""><figcaption></figcaption></figure>

5. After you have configured the source object, click *OK*.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FoUOTkPnEuh3svwVY9MuN%2Fimage.png?alt=media&#x26;token=f3922b7d-ff2a-4895-a3e6-33e5d28bc932" alt=""><figcaption></figcaption></figure>

You have successfully configured your *XML/JSON File Source* object. The fields from the source object can now be mapped to other objects in a dataflow.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FG0MCGo8FEOHsJD19RJ6F%2Fimage.png?alt=media&#x26;token=2f728536-1791-49d9-b960-bbd7d840e194" alt=""><figcaption></figcaption></figure>
