Convert Json array into csv using NifiCreate ArrayList from arrayHow do I check if an array includes an object in JavaScript?Can comments be used in JSON?How to append something to an array?What is the correct JSON content type?Why does Google prepend while(1); to their JSON responses?Loop through an array in JavaScriptHow do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?Convert Json array into csv using apache Nifi

How to creep the reader out with what seems like a normal person?

Why do Ichisongas hate elephants and hippos?

A non-technological, repeating, visible object in the sky, holding its position in the sky for hours

Will tsunami waves travel forever if there was no land?

In gnome-terminal only 2 out of 3 zoom keys work

Can I get candy for a Pokemon I haven't caught yet?

Does the EU Common Fisheries Policy cover British Overseas Territories?

Asahi Dry Black beer can

Was it really necessary for the Lunar Module to have 2 stages?

How to determine the actual or "true" resolution of a digital photograph?

Colliding particles and Activation energy

Reverse the word in a string with the same order in javascript

Where did the extra Pym particles come from in Endgame?

Weird result in complex limit

If Earth is tilted, why is Polaris always above the same spot?

Confusion about capacitors

How deep to place a deadman anchor for a slackline?

Python "triplet" dictionary?

Has any spacecraft ever had the ability to directly communicate with civilian air traffic control?

Confused by notation of atomic number Z and mass number A on periodic table of elements

Find the coordinate of two line segments that are perpendicular

gnu parallel how to use with ffmpeg

What does YCWCYODFTRFDTY mean?

What is a Recurrent Neural Network?



Convert Json array into csv using Nifi


Create ArrayList from arrayHow do I check if an array includes an object in JavaScript?Can comments be used in JSON?How to append something to an array?What is the correct JSON content type?Why does Google prepend while(1); to their JSON responses?Loop through an array in JavaScriptHow do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?Convert Json array into csv using apache Nifi






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm looking to convert JSON with an array to csv format. The number of elements inside the array is dynamic for each row. I tried using this flow, ( attached the flow file xml on the post ).



GetFile --> ConvertRecord --> UpdateAttribute --> PutFile



Are there any other alternatives?



JSON format:



 
"LogData":
"Location":"APAC",
"product":"w1"
,
"Outcome":[

"limit":"0",
"pri":"3",
"result":"pass"
,

"limit":"1",
"pri":"2",
"result":"pass"
,

"limit":"5",
"priority":"1",
"result":"fail"

],
"attr":
"vers":"1",
"datetime":"2018-01-10 00:36:00"




Expected output in csv:



location, product, limit, pri, result, vers, datetime
APAC w1 0 3 pass 1 2018-01-10 00:36:00
APAC w1 1 2 pass 1 2018-01-10 00:36:00
APAC w1 5 1 fail 1 2018-01-10 00:36:00


Output from the attached flow:



LogData,Outcome,attr
"MapRecord[product=w1, Location=APAC]","[MapRecord[limit=0, result=pass, pri=3], MapRecord[limit=1, result=pass, pri=2], MapRecord[limit=5, result=fail]]","MapRecord[datetime=2018-01-10 00:36:00, vers=1]"


enter image description here



ConvertRecord Config:
enter image description here



JSONTReeReader Controller service Config:
enter image description here
CSVRecordSetWriter Controller service Config:
enter image description here
Avroschmeregistry Contoller service config:
enter image description here



Avro schema:
"name": "myschema", "type": "record", "namespace": "myschema", "fields": ["name": "LogData","type": "name": "LogData", "type": "record", "fields": [ "name": "Location", "type": "string", "name": "product", "type": "string" ],"name": "Outcome","type": "type": "array", "items": "name": "Outcome_record","type": "record","fields": [ "name": "limit","type": "string" , "name": "pri","type": ["string","null"] , "name": "result","type": "string" ] ,"name": "attr","type": "name": "attr", "type": "record", "fields": [ "name": "vers", "type": "string", "name": "datetime", "type": "string" ] ]










share|improve this question
























  • Could you update the question with Record Reader/Writer controller service schemas?

    – Shu
    Mar 22 at 20:41











  • updated with the screenshots of all the configuration and the avro schema details.

    – vishwanatha handadi
    Mar 23 at 3:03

















0















I'm looking to convert JSON with an array to csv format. The number of elements inside the array is dynamic for each row. I tried using this flow, ( attached the flow file xml on the post ).



GetFile --> ConvertRecord --> UpdateAttribute --> PutFile



Are there any other alternatives?



JSON format:



 
"LogData":
"Location":"APAC",
"product":"w1"
,
"Outcome":[

"limit":"0",
"pri":"3",
"result":"pass"
,

"limit":"1",
"pri":"2",
"result":"pass"
,

"limit":"5",
"priority":"1",
"result":"fail"

],
"attr":
"vers":"1",
"datetime":"2018-01-10 00:36:00"




Expected output in csv:



location, product, limit, pri, result, vers, datetime
APAC w1 0 3 pass 1 2018-01-10 00:36:00
APAC w1 1 2 pass 1 2018-01-10 00:36:00
APAC w1 5 1 fail 1 2018-01-10 00:36:00


Output from the attached flow:



LogData,Outcome,attr
"MapRecord[product=w1, Location=APAC]","[MapRecord[limit=0, result=pass, pri=3], MapRecord[limit=1, result=pass, pri=2], MapRecord[limit=5, result=fail]]","MapRecord[datetime=2018-01-10 00:36:00, vers=1]"


enter image description here



ConvertRecord Config:
enter image description here



JSONTReeReader Controller service Config:
enter image description here
CSVRecordSetWriter Controller service Config:
enter image description here
Avroschmeregistry Contoller service config:
enter image description here



Avro schema:
"name": "myschema", "type": "record", "namespace": "myschema", "fields": ["name": "LogData","type": "name": "LogData", "type": "record", "fields": [ "name": "Location", "type": "string", "name": "product", "type": "string" ],"name": "Outcome","type": "type": "array", "items": "name": "Outcome_record","type": "record","fields": [ "name": "limit","type": "string" , "name": "pri","type": ["string","null"] , "name": "result","type": "string" ] ,"name": "attr","type": "name": "attr", "type": "record", "fields": [ "name": "vers", "type": "string", "name": "datetime", "type": "string" ] ]










share|improve this question
























  • Could you update the question with Record Reader/Writer controller service schemas?

    – Shu
    Mar 22 at 20:41











  • updated with the screenshots of all the configuration and the avro schema details.

    – vishwanatha handadi
    Mar 23 at 3:03













0












0








0








I'm looking to convert JSON with an array to csv format. The number of elements inside the array is dynamic for each row. I tried using this flow, ( attached the flow file xml on the post ).



GetFile --> ConvertRecord --> UpdateAttribute --> PutFile



Are there any other alternatives?



JSON format:



 
"LogData":
"Location":"APAC",
"product":"w1"
,
"Outcome":[

"limit":"0",
"pri":"3",
"result":"pass"
,

"limit":"1",
"pri":"2",
"result":"pass"
,

"limit":"5",
"priority":"1",
"result":"fail"

],
"attr":
"vers":"1",
"datetime":"2018-01-10 00:36:00"




Expected output in csv:



location, product, limit, pri, result, vers, datetime
APAC w1 0 3 pass 1 2018-01-10 00:36:00
APAC w1 1 2 pass 1 2018-01-10 00:36:00
APAC w1 5 1 fail 1 2018-01-10 00:36:00


Output from the attached flow:



LogData,Outcome,attr
"MapRecord[product=w1, Location=APAC]","[MapRecord[limit=0, result=pass, pri=3], MapRecord[limit=1, result=pass, pri=2], MapRecord[limit=5, result=fail]]","MapRecord[datetime=2018-01-10 00:36:00, vers=1]"


enter image description here



ConvertRecord Config:
enter image description here



JSONTReeReader Controller service Config:
enter image description here
CSVRecordSetWriter Controller service Config:
enter image description here
Avroschmeregistry Contoller service config:
enter image description here



Avro schema:
"name": "myschema", "type": "record", "namespace": "myschema", "fields": ["name": "LogData","type": "name": "LogData", "type": "record", "fields": [ "name": "Location", "type": "string", "name": "product", "type": "string" ],"name": "Outcome","type": "type": "array", "items": "name": "Outcome_record","type": "record","fields": [ "name": "limit","type": "string" , "name": "pri","type": ["string","null"] , "name": "result","type": "string" ] ,"name": "attr","type": "name": "attr", "type": "record", "fields": [ "name": "vers", "type": "string", "name": "datetime", "type": "string" ] ]










share|improve this question
















I'm looking to convert JSON with an array to csv format. The number of elements inside the array is dynamic for each row. I tried using this flow, ( attached the flow file xml on the post ).



GetFile --> ConvertRecord --> UpdateAttribute --> PutFile



Are there any other alternatives?



JSON format:



 
"LogData":
"Location":"APAC",
"product":"w1"
,
"Outcome":[

"limit":"0",
"pri":"3",
"result":"pass"
,

"limit":"1",
"pri":"2",
"result":"pass"
,

"limit":"5",
"priority":"1",
"result":"fail"

],
"attr":
"vers":"1",
"datetime":"2018-01-10 00:36:00"




Expected output in csv:



location, product, limit, pri, result, vers, datetime
APAC w1 0 3 pass 1 2018-01-10 00:36:00
APAC w1 1 2 pass 1 2018-01-10 00:36:00
APAC w1 5 1 fail 1 2018-01-10 00:36:00


Output from the attached flow:



LogData,Outcome,attr
"MapRecord[product=w1, Location=APAC]","[MapRecord[limit=0, result=pass, pri=3], MapRecord[limit=1, result=pass, pri=2], MapRecord[limit=5, result=fail]]","MapRecord[datetime=2018-01-10 00:36:00, vers=1]"


enter image description here



ConvertRecord Config:
enter image description here



JSONTReeReader Controller service Config:
enter image description here
CSVRecordSetWriter Controller service Config:
enter image description here
Avroschmeregistry Contoller service config:
enter image description here



Avro schema:
"name": "myschema", "type": "record", "namespace": "myschema", "fields": ["name": "LogData","type": "name": "LogData", "type": "record", "fields": [ "name": "Location", "type": "string", "name": "product", "type": "string" ],"name": "Outcome","type": "type": "array", "items": "name": "Outcome_record","type": "record","fields": [ "name": "limit","type": "string" , "name": "pri","type": ["string","null"] , "name": "result","type": "string" ] ,"name": "attr","type": "name": "attr", "type": "record", "fields": [ "name": "vers", "type": "string", "name": "datetime", "type": "string" ] ]







arrays json apache-nifi






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 3:02







vishwanatha handadi

















asked Mar 22 at 19:19









vishwanatha handadivishwanatha handadi

124




124












  • Could you update the question with Record Reader/Writer controller service schemas?

    – Shu
    Mar 22 at 20:41











  • updated with the screenshots of all the configuration and the avro schema details.

    – vishwanatha handadi
    Mar 23 at 3:03

















  • Could you update the question with Record Reader/Writer controller service schemas?

    – Shu
    Mar 22 at 20:41











  • updated with the screenshots of all the configuration and the avro schema details.

    – vishwanatha handadi
    Mar 23 at 3:03
















Could you update the question with Record Reader/Writer controller service schemas?

– Shu
Mar 22 at 20:41





Could you update the question with Record Reader/Writer controller service schemas?

– Shu
Mar 22 at 20:41













updated with the screenshots of all the configuration and the avro schema details.

– vishwanatha handadi
Mar 23 at 3:03





updated with the screenshots of all the configuration and the avro schema details.

– vishwanatha handadi
Mar 23 at 3:03












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55306473%2fconvert-json-array-into-csv-using-nifi%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55306473%2fconvert-json-array-into-csv-using-nifi%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript