Azure / Azure/usql

Converting Avro file to JSONs using JsonOutputer

Open
#134 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
231
Forks
666
PR merge metrics
No merged PRs in 30d

Description

I have a requirement where I need to extract JSON files from Avro by using U-SQL. Avro files contain a collection of JSON and need to extract individual JSON from Avro. Here I have written code. I used JsonOuptter() for writing jsons.
```
OUTPUT @source
TO "C://schemaType.json"
USING new JsonOutputter();
```
I am getting JSON as like below.

```
[
{
"type": "C",
"cnn": "1",
"source": "{\r\n \"vendorCd\": \"G\",\r\n \"brandCd\": \"4\",\r\n \"channelCd\": \"C\",\r\n \"accessTypeCd\": \"I\"\r\n}",

},
{
"type": "C",
"cnn": "9",
"source": "{\r\n \"vendorCd\": \"G\",\r\n \"brandCd\": \"4\",\r\n \"channelCd\": \"C\",\r\n \"accessTypeCd\": \"I\"\r\n}",

}
]
```
I am expecting jSON as like below.
```
[
{
"type":"C",
"ccn":"1",
"source":{
"vendorCd":"G",
"brandCd":"4",
"channelCd":"C",
"accessTypeCd":"I"
},
{
"type":"C",
"ccn":"9",
"source":{
"vendorCd":"G",
"brandCd":"4",
"channelCd":"C",
"accessTypeCd":"I"
}
]
```
Thanks for your help and support.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.