Skip to content

Commit 60af6ec

Browse files
Merge pull request #211480 from jonburchel/pr97513
Pr97513
2 parents 947ea1f + c5fb6d1 commit 60af6ec

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

articles/data-factory/data-flow-parse.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Parse data transformation in mapping data flow
2+
title: Parse data transformations in mapping data flow
33
description: Parse embedded column documents
44
author: kromerm
55
ms.author: makromer
@@ -41,21 +41,31 @@ Use the expression builder to set the source for your parsing. This can be as si
4141
* Source JSON data: ```{"ts":1409318650332,"userId":"309","sessionId":1879,"page":"NextSong","auth":"Logged In","method":"PUT","status":200,"level":"free","itemInSession":2,"registration":1384448}```
4242
* Expression: ```(level as string, registration as long)```
4343

44+
* Source Nested JSON data: ```{"car" : {"model" : "camaro", "year" : 1989}, "color" : "white", "transmission" : "v8"}```
45+
* Expression: ```(car as (model as string, year as integer), color as string, transmission as string)```
46+
4447
* Source XML data: ```<Customers><Customer>122</Customer><CompanyName>Great Lakes Food Market</CompanyName></Customers>```
4548
* Expression: ```(Customers as (Customer as integer, CompanyName as string))```
4649

50+
* Source XML with Attribute data: ```<cars><car model="camaro"><year>1989</year></car></cars>```
51+
* Expression: ```(cars as (car as ({@model} as string, year as integer)))```
52+
* Note: If you run into errors extracting attributes (i.e. @model) from a complex type, a workaround is to convert the complex type to a string, remove the @ symbol (i.e. replace(toString(your_xml_string_parsed_column_name.cars.car),'@','')
53+
), and then use the parse JSON transformation activity.
54+
4755
### Output column type
4856

49-
Here is where you'll configure the target output schema from the parsing that will be written into a single column. The easiest way to set a schema for your output from parsing is to click the 'Detect Type' button on the top right of the expression builder. ADF will attempt to autodetect the schema from the string field which you are parsing and set it for you in the output expression.
57+
Here's where you'll configure the target output schema from the parsing that will be written into a single column. The easiest way to set a schema for your output from parsing is to select the 'Detect Type' button on the top right of the expression builder. ADF will attempt to autodetect the schema from the string field, which you're parsing and set it for you in the output expression.
5058

5159
:::image type="content" source="media/data-flow/data-flow-parse-2.png" alt-text="Parse example":::
5260

53-
In this example, we have defined parsing of the incoming field "jsonString" which is plain text, but formatted as a JSON structure. We're going to store the parsed results as JSON in a new column called "json" with this schema:
61+
In this example, we have defined parsing of the incoming field "jsonString", which is plain text, but formatted as a JSON structure. We're going to store the parsed results as JSON in a new column called "json" with this schema:
5462

5563
`(trade as boolean, customers as string[])`
5664

5765
Refer to the inspect tab and data preview to verify your output is mapped properly.
5866

67+
Use the Derived Column activity to extract hierarchical data (that is, your_complex_column_name.car.model in the expression field)
68+
5969
## Examples
6070

6171
```

0 commit comments

Comments
 (0)