Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Child getting appended to the parent node #28

Closed
saipallavi opened this issue Jun 15, 2017 · 1 comment
Closed

First Child getting appended to the parent node #28

saipallavi opened this issue Jun 15, 2017 · 1 comment

Comments

@saipallavi
Copy link

Hi,
I use similar kind of multi-array set. I am using the below input:

var test=[
{
"CODE": "AA",
"GROUP_NAME": "aaaaaa",
"GROUP_DESC": "aaaaaaaaa",
"CHILD_GROUP": [
{
"CODE": "AA",
"GROUP_NAME": "aaaaaa",
"CHILD_CODE": "bb"
},
{
"CODE": "AA",
"GROUP_NAME": "aaaaaa",
"CHILD_CODE": "cc"
},
{
"CODE": "AA",
"GROUP_NAME": "aaaaaa",
"CHILD_CODE": "dd"
}
]
}
]
jsonexport(test,function(err, csv){
if(err) return console.log(err);
console.log(csv);
});
And my output is :

CODE,GROUP_NAME,GROUP_DESC,CHILD_GROUP.CODE,CHILD_GROUP.GROUP_NAME,CHILD_GROUP.CHILD_CODE
AA,aaaaaa,aaaaaaaaa,AA,aaaaaa,bb
,,,AA,aaaaaa,cc
,,,AA,aaaaaa,dd

The first child is getting appended to the parent. Could you please provide a solution for this???

I need the output like this:
AA,aaaaaa,aaaaaaaaa
,,,AA,aaaaaa,bb
,,,AA,aaaaaa,cc
,,,AA,aaaaaa,dd

@kaue
Copy link
Owner

kaue commented Jun 15, 2017

Duplicate #22

@kaue kaue closed this as completed Jun 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants