-1

Below is the CSV - input file

Id Type SubType Input Accounts 196 ListenToMusic StereoReceiver DVD 22 196 ListenToMusic StereoReceiver GAME 19 196 PlayGame StereoReceiver Game 2404 196 PlayGame StereoReceiver DVD 831

Expected Output as image,

https://i.stack.imgur.com/w5eTf.jpg

Thameem
  • 23
  • 5
  • What does your app look like? Where are you trying to do this. i.e. client/server? Can you share the code you currently have? – dan Apr 06 '16 at 17:13
  • I am trying to convert CSV to JSON using node.js. But i stuck with the complex format. Could you please help me? – Thameem Apr 06 '16 at 17:19
  • There's a whole load of packages that should be able to help you out with this. csvtojson - https://www.npmjs.com/package/csvtojson for example. There's an example of it being used here: http://stackoverflow.com/questions/16831250/how-to-convert-csv-to-json-in-node-js – dan Apr 06 '16 at 17:24
  • I already tried with that option but its not giving me the output what i expect. Hence i am looking for the help. – Thameem Apr 06 '16 at 17:30

1 Answers1

0

I think your back problem is that CSV is row column format.

ex Name,Address,Phone Al Smith,111 Main Street,(555) 121 - 1234, ... Jenny Jones,1891 Apple Ave,(333) 345 - 8765

Your in data is hierarchical

From you example: DVD,GAME 22,19 2401,831

is a valid CSV file. File conversion does not create information and your final data destination has more information (in the form relationship hierarchy) than your starting data

muchavie
  • 326
  • 2
  • 8