I am using google's GSON parsing library and I'm not sure if this has been asked before (I did check what I could find) but, here I go!! It's regarding the fromJSON method and how it refuses to interpret some classes as arrays.
Given the JSON structure below:
{"visualization": {
"root": {
"fullname": "CC/dudu",
"name": "dudu",
"type": "String",
"children": [
{
"fullname": "CC/dudu/lulu",
"name": "lulu",
"type": "String"
}
]
},
"traces": {
"messages": [
{
"from": "dudu",
"method": "call()",
"scenario": "#1",
"timestamp": "09-12-2013 00:21:14",
"to": "dudu",
"type": "void",
"violation": "true",
"visible": "true"
}
],
"scenarios": [
{
"name": "testscenario",
"id": "#1",
"description": "testing parsing!"
}
]
}
}}
And the accompanying contained classes.
public class Response {
private Visualization visualization;
//+getter/setter
}
public class Visualization {
private Component root;
private Map<String, Trace> traces;
//+getter/setter
}
public class Trace {
private ArrayList<Message> messages;
private ArrayList<Scenario> scenarios;
//+getter/setter
}
I get the error that GSON was expecting an Object and NOT an Array (before the "[" token of messages). Anyone know why that is? The types (as can be seen in the classes) are List, so it should be fine. And I have tried having more objects in the array and I still get the same error message! Why is Gson interpreting the List<TypeA> type as an object and not an array?
EDIT:
Here's the code code, but it's kinda pointless, since the exception is being thrown because of the parsing process. I doubt you'll find anything useful. "visualization" is a string with a correct JSON format.
Gson gsonParser = new Gson();
Response r = gsonParser.fromJson(visualization, Response.class);
The code below allows you to parse exactly your JSON.
Note that I put all into a class to make easier for you to test it. Anycase, Gson does not work well with inner classes unless they are static. So I suggest you to make a file for each class or use only static inner classes.
package stackoverflow.questions;
import java.util.*;
import com.google.gson.Gson;
public class Q20461706 {
public class Trace {
ArrayList<Message> messages;
ArrayList<Scenario> scenarios;
#Override
public String toString() {
return "Trace [messages=" + messages + ", scenarios=" + scenarios + "]";
}
}
public static class Message {
String from; // "from": "dudu",
String method; // "method": "call()",
String scenario; // "scenario": "#1",
String timestamp; // "timestamp": "09-12-2013 00:21:14",
String to; // "to": "dudu",
String type; // "type": "void",
Boolean violation; // "violation": "true",
Boolean visible; // "visible": "true"
#Override
public String toString() {
return "Message [from=" + from + ", method=" + method + ", scenario=" + scenario + ", timestamp=" + timestamp + ", to=" + to + ", type=" + type + ", violation=" + violation + ", visible=" + visible + "]";
}
}
public static class Scenario {
String name;// "name": "testscenario",
String id; // "id": "#1",
String description; // "description": "testing parsing!"
#Override
public String toString() {
return "Scenario [name=" + name + ", id=" + id + ", description=" + description + "]";
}
}
public static class Component {
String fullname; // "fullname": "CC/dudu",
String name; // "name": "dudu",
String type; // "type": "String",
List<Component> children;
#Override
public String toString() {
return "Component [fullname=" + fullname + ", name=" + name + ", type=" + type + ", children=" + children + "]";
}
}
public static class Visualization {
Component root;
Trace traces;
#Override
public String toString() {
return "Visualization [root=" + root + ", traces=" + traces + "]";
}
}
public static class Response {
Visualization visualization;
#Override
public String toString() {
return "Response [visualization=" + visualization + "]";
}
}
public static void main(String[] args) {
String json =
" {\"visualization\": { "+
" \"root\": { "+
" \"fullname\": \"CC/dudu\", "+
" \"name\": \"dudu\", "+
" \"type\": \"String\", "+
" \"children\": [ "+
" { "+
" \"fullname\": \"CC/dudu/lulu\", "+
" \"name\": \"lulu\", "+
" \"type\": \"String\" "+
" } "+
" ] "+
" }, "+
" \"traces\": { "+
" \"messages\": [ "+
" { "+
" \"from\": \"dudu\", "+
" \"method\": \"call()\", "+
" \"scenario\": \"#1\", "+
" \"timestamp\": \"09-12-2013 00:21:14\", "+
" \"to\": \"dudu\", "+
" \"type\": \"void\", "+
" \"violation\": \"true\", "+
" \"visible\": \"true\" "+
" } "+
" ], "+
" \"scenarios\": [ "+
" { "+
" \"name\": \"testscenario\", "+
" \"id\": \"#1\", "+
" \"description\": \"testing parsing!\" "+
" } "+
" ] "+
" } "+
" }} ";
Gson gsonParser = new Gson();
Response r = gsonParser.fromJson(json, Response.class);
System.out.println(r);
}
}
To respond to your question, note that I changed your Visualization class with Trace traces since you have only a Trace object in your JSON and not an array. This is why Gson complains.
Note also that I avoided to parse the date as date, you need to specify a custom date format for that, but it's beyond the scope of this question. You can find many examples here on SO.
Related
I am trying to convert the keys in my json string to camelCase..i have gone trough various posts in the stackoverflow but couldn't come to the solution..
i have a json string coming in the below format..
{
"tech":[
{
"id":"1",
"company_name":"Microsoft",
"country_of_origin":"USA"
},
{
"id":"2",
"company_name":"SAP",
"country_of_origin":"Germany"
}
],
"Manufacturing":[
{
"id":"3",
"company_name":"GM",
"country_of_origin":"USA"
},
{
"id":"4",
"company_name":"BMW",
"country_of_origin":"Germany"
}
]
}
Expected Response
{
"tech":[
{
"id":"1",
"companyName":"Microsoft",
"countryOfOrigin":"USA"
},
{
"id":"2",
"companyName":"SAP",
"countryOfOrigin":"Germany"
}
],
"Manufacturing":[
{
"id":"3",
"companyName":"GM",
"countryOfOrigin":"USA"
},
{
"id":"4",
"companyName":"BMW",
"countryOfOrigin":"Germany"
}
]
}
i have written a jsonDeserializer class based on previous post in stackoverflow..
Gson gson = new GsonBuilder()
.registerTypeAdapter(UpperCaseAdapter.TYPE, new UpperCaseAdapter())
.create();
Map<String, List<Company>> mapDeserialized = gson.fromJson(jsonString, UpperCaseAdapter.TYPE);
System.out.println(mapDeserialized);
And the deserilizer
public class UpperCaseAdapter implements JsonDeserializer<Map<String, Object>> {
public static final Type TYPE = new TypeToken<Map<String, Object>>() {}.getType();
#Override
public Map<String, Object> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
Map<String, Object> map = new HashMap<>();
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()) {
Object value = null;
if (entry.getValue().isJsonPrimitive()) {
value = entry.getValue().getAsString();
} else if (entry.getValue().isJsonObject()) {
value = context.deserialize(entry.getValue(), TYPE);
} else if (entry.getValue().isJsonArray()) {
for(JsonElement jsonElement:entry.getValue().getAsJsonArray()){
value=context.deserialize(jsonElement,TYPE);
}
} else if (entry.getValue().isJsonNull()) {
continue;
}
map.put(CaseFormat.LOWER_UNDERSCORE.to(
CaseFormat.LOWER_CAMEL, entry.getKey()), value);
}
return map;
}
}
Model class
public class Company {
private String id;
private String compnayName;
private String countryOfOrigin;
}
When i use the above deserilizer though it is able to convert the keys to camle case for some json array object....i can see that it is only doing that for one jsonobject in each array and not taking other array objects in to consideration.as shown below.
Wrong Response i am getting with above serializer(missing other jsonobjecsts and the key manufacturing is converted to lower):
{
"tech="{
"companyName=SAP",
id=2,
"countryOfOrigin=Germany"
},
"manufacturing="{
"companyName=BMW",
id=4,
"countryOfOrigin=Germany"
}
}
I know there are lot of posts available in stackoverflow and i have to this extent solely based on those posts but as i am new to Java and json serilization i couldn't progress anymore...any help in this regard is greatly appreciated thanks in advance
you can use the following code to get the CamelCase string;
static public class Company {
private String id;
private String companyName;
private String countryOfOrigin;
public Company() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getCountryOfOrigin() {
return countryOfOrigin;
}
public void setCountryOfOrigin(String countryOfOrigin) {
this.countryOfOrigin = countryOfOrigin;
}
}
#Test
void t4() throws JsonProcessingException {
ObjectMapper mapperSC = new ObjectMapper();
mapperSC.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
ObjectMapper mapper = new ObjectMapper();
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.LOWER_CAMEL_CASE);
String data = "{ " +
" \"tech\":[ " +
" { " +
" \"id\":\"1\", " +
" \"company_name\":\"Microsoft\", " +
" \"country_of_origin\":\"USA\" " +
" }, " +
" { " +
" \"id\":\"2\", " +
" \"company_name\":\"SAP\", " +
" \"country_of_origin\":\"Germany\" " +
" } " +
" ], " +
" \"Manufacturing\":[ " +
" { " +
" \"id\":\"3\", " +
" \"company_name\":\"GM\", " +
" \"country_of_origin\":\"USA\" " +
" }, " +
" { " +
" \"id\":\"4\", " +
" \"company_name\":\"BMW\", " +
" \"country_of_origin\":\"Germany\" " +
" } " +
" ] " +
"}";
TypeFactory tf = mapper.getTypeFactory();
JavaType jt = tf.constructMapType(Map.class, tf.constructType(String.class), tf.constructArrayType(Company.class));
Object o = mapperSC.readValue(data, jt);
System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(o));
}
The output will be;
{
"tech" : [ {
"id" : "1",
"companyName" : "Microsoft",
"countryOfOrigin" : "USA"
}, {
"id" : "2",
"companyName" : "SAP",
"countryOfOrigin" : "Germany"
} ],
"Manufacturing" : [ {
"id" : "3",
"companyName" : "GM",
"countryOfOrigin" : "USA"
}, {
"id" : "4",
"companyName" : "BMW",
"countryOfOrigin" : "Germany"
} ]
}
Given the following Json data:
"values": [
{
"type": "any",
"value": "MO918038B",
"key": "nino"
},
{
"type": "any",
"value": "1956-11-18",
"key": "dob"
},
{
"type": "any",
"value": "q",
"key": "memorableWord"
},
{
"type": "any",
"value": "E13468",
"key": "pin"
},
]
And the following Java class:
public void doStuff() {
try (Reader reader = new FileReader("global-vars.json")) {
JsonObject json = new Gson().fromJson(reader, JsonObject.class);
String reg = json.get("values").toString();
System.out.println(reg);
} catch (IOException e) {
e.printStackTrace();
}
}
I'm not clear, after searching, how best to obtain the "value" of, for example, "nino" which is = "MO918038B"
Type listType = new TypeToken<List<YourObjectClass>>() {}.getType();
List<YourObjectClass> yourList = new Gson().fromJson(yourJson, listType);
Since your posted JSON isn't RFC 4627 conformant, I assume this array is inside of an object.
Code would look like this:
public class YourClass {
class Value {
public String type;
public String value;
public String key;
}
public Value[] values;
}
public class App{
public static void main(String[] args) {
String json = "{ \"values\": [\n" +
"{\n" +
" \"type\": \"any\",\n" +
" \"value\": \"MO918038B\",\n" +
" \"key\": \"nino\"\n" +
"},\n" +
"{\n" +
" \"type\": \"any\",\n" +
" \"value\": \"1956-11-18\",\n" +
" \"key\": \"dob\"\n" +
"},\n" +
"{\n" +
" \"type\": \"any\",\n" +
" \"value\": \"q\",\n" +
" \"key\": \"memorableWord\"\n" +
"},\n" +
"{\n" +
" \"type\": \"any\",\n" +
" \"value\": \"E13468\",\n" +
" \"key\": \"pin\"\n" +
"}\n" +
"]}";
YourClass yourClass = new Gson().fromJson(json, YourClass.class);
for (YourClass.Value value : yourClass.values) {
if (value.key.equals("nino")) {
System.out.println(value.value);
}
}
}
}
I have a pojo as shown below. I have a toString method in it which is responsible for converting it to json data. As you can see I am using gson in that toString method.
// removed setters for brevity
public class User {
private String name, email, password;
// This information field is already a json as mentioned below
private String information;
public User(String name, String email, String password, String information) {
super();
this.name = name;
this.email = email;
this.password = password;
this.information = information;
}
#Override
public String toString() {
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
return gson.toJson(this);
}
The problem is that out of all these fields, my information field will already be a json string. In my main program, I am filling this User object like this.
// filled it with random info, but I will get this from someplace else
String info = "{ \r\n" +
" \"street_address\":{ \r\n" +
" \"type\":\"string\"\r\n" +
" },\r\n" +
" \"city\":{ \r\n" +
" \"type\":\"string\"\r\n" +
" },\r\n" +
" \"state\":{ \r\n" +
" \"type\":\"string\"\r\n" +
" }\r\n" +
"}";
User user = new User("John", "Doe", "password", info);
return user.toString();
This is the output that I am getting.
{
"name": "John",
"email": "Doe",
"password": "password",
"information": "{\r\n \"street_address\": { \"type\": \"string\" },\r\n \"city\": { \"type\": \"string\" },\r\n \"state\": { \"type\": \"string\" }\r\n}"
}
What I want is that last information field to also be properly formatted meaning this is what I am expecting for this example.
{
"name":"John",
"email":"Doe",
"password":"password",
"information":{
"street_address":{
"type":"string"
},
"city":{
"type":"string"
},
"state":{
"type":"string"
}
}
}
All,
I have following JSON response after request get list of users. I want to pull just only one user's id using userName. For example if i want id of userName Test1, how to do that? Any help will be appreciated.
{
"displayLength": "4",
"iTotal": "20",
"users": [
{
"id": "2",
"userName": "Test1",
"Group": { id:1
name:"Test-Admin"
}
},
{
"id": "17",
"userName": "Test2",
"Group": { id:1
name:"Test-Admin"
}
},
{
"id": "32",
"userName": "Test3",
"Group": { id:1
name:"Test-Admin"
}
},
{
"id": "35",
"userName": "Test4",
"Group": { id:1
name:"Test-Admin"
}
}
]
}
Thanks,
See if this below code helps. Just pass user name to userName variable and let the code find the userId for you.
JSONObject json = new JSONObject(" {\n" + " \"displayLength\": \"4\",\n"
+ " \"iTotal\": \"20\",\n" + " \"users\": [\n" + " {\n"
+ " \"id\": \"2\",\n" + " \"userName\": \"Test1\",\n"
+ " \"Group\": { id:1,\n" + " name:\"Test-Admin\"\n"
+ " }\n" + " },\n" + " {\n" + " \"id\": \"17\",\n"
+ " \"userName\": \"Test2\",\n" + " \"Group\": { id:1,\n"
+ " name:\"Test-Admin\"\n" + " }\n" + " },\n"
+ " {\n" + " \"id\": \"32\",\n" + " \"userName\": \"Test3\",\n"
+ " \"Group\": { id:1,\n" + " name:\"Test-Admin\"\n"
+ " }\n" + " },\n" + " {\n" + " \"id\": \"35\",\n"
+ " \"userName\": \"Test4\",\n" + " \"Group\": { id:1,\n"
+ " name:\"Test-Admin\"\n" + " }\n" + " } \n"
+ "\n" + " ]\n" + " }");
JSONArray array = json.getJSONArray("users");
String userName = "Test1";
Integer userId = null;
for (int i = 0; i < array.length() && userId == null; i++) {
JSONObject jsonIn = (JSONObject) array.get(i);
if (jsonIn.optString("userName").equals(userName)) {
userId = jsonIn.optInt("id");
}
}
System.out.println("User ID for User Name '" + userName + "' is : " + userId);
I recomend use http-request built on apache http api. You must create class ResponseData to parse response.
private static final HttpRequest<ResponseData> HTTP_REQUEST =
HttpRequestBuilder.createGet(yourUri, ResponseData.class).build();
public void test() {
HTTP_REQUEST.execute().ifHasContent(responseData -> {
Optional<User> foundedUser = responseData.getUsers()
.stream()
.filter(user -> "Test1".equals(user.getUserName()))
.findFirst();
foundedUser.ifPresent(user -> System.out.println(user.getId()));
});
}
class ResponseData {
private int displayLength;
private int iTotal;
private List<User> users;
public int getDisplayLength() {
return displayLength;
}
public void setDisplayLength(int displayLength) {
this.displayLength = displayLength;
}
public int getiTotal() {
return iTotal;
}
public void setiTotal(int iTotal) {
this.iTotal = iTotal;
}
public List<User> getUsers() {
return users;
}
public void setUsers(List<User> users) {
this.users = users;
}
}
class User {
private int id;
private String userName;
private Group Group;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Group getGroup() {
return Group;
}
public void setGroup(Group group) {
Group = group;
}
}
class Group {
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Note: Your json is incorrect. See Corrected:
{
"displayLength": "4",
"iTotal": "20",
"users": [
{
"id": "2",
"userName": "Test1",
"Group": {
"id": 1,
"name": "Test-Admin"
}
},
{
"id": "17",
"userName": "Test2",
"Group": {
"id": 1,
"name": "Test-Admin"
}
},
{
"id": "32",
"userName": "Test3",
"Group": {
"id": 1,
"name": "Test-Admin"
}
},
{
"id": "35",
"userName": "Test4",
"Group": {
"id": 1,
"name": "Test-Admin"
}
}
]
}
jsonObj.getJsonArray("users") and then convert the array to list. Now use Java 8 Stream and Filter api's to extract the desired output.
The below is a sample Json file.
{"Yjson":
[
{
"Name": "crunchify.com",
"Author": "App Shah",
"Address": "New York",
"Company Services": [{
"Service": "Site SEO Review",
"Link": "https://crunchify.com/services/site-seo-review-service/"
}, {
"Service": "Full Website Design Service",
"Link": "https://crunchify.com/services/full-website-design-service/"
}, {
"Service": "WordPress Optimization & Consultation",
"Link": "https://crunchify.com/services/wordpress-optimization-service/"
}, {
"Service": "WordPress Optimization & Consultation",
"Link": "https://crunchify.com/services/wordpress-optimization-service/"
}]
},
{
"Name": "xyz.com",
"Author": "xyz Shah",
"Address": "toronto",
"Company Services": [{
"Service": "Site SEO Review",
"Link": "https://crunchify.com/services/site-seo-review-service/"
}, {
"Service": "Full Website Design Service",
"Link": "https://crunchify.com/services/full-website-design-service/"
}, {
"Service": "WordPress Optimization & Consultation",
"Link": "https://crunchify.com/services/wordpress-optimization-service/"
}]
}
]
}
How to store all the values of each key in a Arraylist in java ?
such as the array list for key name will contain [crunchicy.com,xyz.com]. similarly for every key there should be a array list.
example :
list name : [crunchify.com,xyz]
list Author : [aap shah,xyz shah]
list name : [newyork,toronto]
How to parse every json object that can be nested and dynamic in
nature and keep them in array lists according to keys ??
Here is code for reading your JSON text using Jackson Databind and writing it to CSV using Apache Commons CSV.
When using Databind, you need Java POJO classes, optionally annotated using #JsonProperty to specify the JSON field names.
Your JSON text is included inline at the bottom to produce an MCVE.
import java.util.List;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
public class Test {
public static void main(String[] args) throws Exception {
Root root = new ObjectMapper().readValue(Input.json, Root.class);
CSVPrinter printer = CSVFormat.DEFAULT
.withHeader("Name", "Author", "Address", "Service", "Link")
.print(System.out);
for (Site site : root.getSites())
for (Service service : site.getServices())
printer.printRecord(site.getName(), site.getAuthor(), site.getAddress(),
service.getService(), service.getLink());
}
}
class Root {
private List<Site> sites;
#JsonProperty("Yjson")
public List<Site> getSites() {
return this.sites;
}
public void setSites(List<Site> sites) {
this.sites = sites;
}
}
class Site {
private String name;
private String author;
private String address;
private List<Service> services;
#JsonProperty("Name")
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
#JsonProperty("Author")
public String getAuthor() {
return this.author;
}
public void setAuthor(String author) {
this.author = author;
}
#JsonProperty("Address")
public String getAddress() {
return this.address;
}
public void setAddress(String address) {
this.address = address;
}
#JsonProperty("Company Services")
public List<Service> getServices() {
return this.services;
}
public void setServices(List<Service> services) {
this.services = services;
}
}
class Service {
private String service;
private String link;
#JsonProperty("Service")
public String getService() {
return this.service;
}
public void setService(String service) {
this.service = service;
}
#JsonProperty("Link")
public String getLink() {
return this.link;
}
public void setLink(String link) {
this.link = link;
}
}
class Input {
static final String json =
"{\"Yjson\":\n" +
"[\n" +
"{\n" +
"\"Name\": \"crunchify.com\",\n" +
" \"Author\": \"App Shah\",\n" +
" \"Address\": \"New York\",\n" +
" \"Company Services\": [{\n" +
" \"Service\": \"Site SEO Review\",\n" +
" \"Link\": \"https://crunchify.com/services/site-seo-review-service/\"\n" +
" }, {\n" +
" \"Service\": \"Full Website Design Service\",\n" +
" \"Link\": \"https://crunchify.com/services/full-website-design-service/\"\n" +
" }, {\n" +
" \"Service\": \"WordPress Optimization & Consultation\",\n" +
" \"Link\": \"https://crunchify.com/services/wordpress-optimization-service/\"\n" +
" }, {\n" +
" \"Service\": \"WordPress Optimization & Consultation\",\n" +
" \"Link\": \"https://crunchify.com/services/wordpress-optimization-service/\"\n" +
" }]\n" +
"},\n" +
"{\n" +
" \"Name\": \"xyz.com\",\n" +
" \"Author\": \"xyz Shah\",\n" +
" \"Address\": \"toronto\",\n" +
" \"Company Services\": [{\n" +
" \"Service\": \"Site SEO Review\",\n" +
" \"Link\": \"https://crunchify.com/services/site-seo-review-service/\"\n" +
" }, {\n" +
" \"Service\": \"Full Website Design Service\",\n" +
" \"Link\": \"https://crunchify.com/services/full-website-design-service/\"\n" +
" }, {\n" +
" \"Service\": \"WordPress Optimization & Consultation\",\n" +
" \"Link\": \"https://crunchify.com/services/wordpress-optimization-service/\"\n" +
" }]\n" +
"}\n" +
"]\n" +
"}";
}
Output
Name,Author,Address,Service,Link
crunchify.com,App Shah,New York,Site SEO Review,https://crunchify.com/services/site-seo-review-service/
crunchify.com,App Shah,New York,Full Website Design Service,https://crunchify.com/services/full-website-design-service/
crunchify.com,App Shah,New York,WordPress Optimization & Consultation,https://crunchify.com/services/wordpress-optimization-service/
crunchify.com,App Shah,New York,WordPress Optimization & Consultation,https://crunchify.com/services/wordpress-optimization-service/
xyz.com,xyz Shah,toronto,Site SEO Review,https://crunchify.com/services/site-seo-review-service/
xyz.com,xyz Shah,toronto,Full Website Design Service,https://crunchify.com/services/full-website-design-service/
xyz.com,xyz Shah,toronto,WordPress Optimization & Consultation,https://crunchify.com/services/wordpress-optimization-service/
If you use Maven, these are the two dependencies you need:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.4</version>
</dependency>