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

Parse CSV with objects and arrays #42

Open
kadimulam opened this issue Mar 30, 2016 · 0 comments
Open

Parse CSV with objects and arrays #42

kadimulam opened this issue Mar 30, 2016 · 0 comments

Comments

@kadimulam
Copy link

I am having an issue when i parse a CSV file as shown below.

Original JSON:

{
"firstName": "John",
"lastName": "Smith",
"age": 25,
"address":
{
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021"
},
"phoneNumber":
[
{
"type": "home",
"number": "212 555-1234"
},
{
"type": "fax",
"number": "646 555-4567"
}
]
}

When i use one of the tool online, it converts the above JSON to the below.
firstName,lastName,age,address/streetAddress,address/city,address/state,address/postalCode,phoneNumber/0/type,phoneNumber/0/number,phoneNumber/1/type,phoneNumber/1/number
John,Smith,25,25 2nd Street,New York,NY,10021,home,212 555-1234,fax,646 555-4567

I am trying to convert the above CSV file back to JSON with your tool and i am expecting the output as shown above, but it is different and converting each column header as a element in JSON.

If i want to convert a CSV file to above JSON format how should i provide the CSV to your tool? Basically my JSON can have Arrays, objects and it will be huge. Could you please advise?

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

1 participant