I am trying to convert data from a csv file to json format.Search on the internet told me that we need to use external libraries.But all the samples that i found had headers included in the CSV file.But I do not have the headers in my CSV file.So I do not know how to parse.
Below is the sample data in CSV :
I need the data in below format :
Here "ColumnA","ColumnB", and so on are some constants(we can say as hardcoded values).
Not sure if any external lib is required for this or we can do this with no String operations.
Here is the code i have so far :
You do not need external libraries. Printing JSON can be done without external support methods, though for more complex applications, there are external libraries that can help. For your problem, they're not worth the trouble.
You could use an external library to parse the CSV more reliably. Using a Scanner to split the columns is fine for a file full of numbers and/or simple text, but when you have columns that have quotes and/or commas as part of the column value, that's when you'd want an external library that already knows how to do that - it saves design and coding time to add that extra logic and some other poor slob has already done the debugging.
So you're fine as-is.
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
please buy this thing and then I get a fat cut of the action:
Create Edit Print & Convert PDF Using Free API with Java