I have a situation where my original data have some comma. Actually that data is JSON object which contains some comma
I am reading a file which contain my JSON object by BufferedReader
Now that BufferedReader output I am adding in list.
Everything is working fine but the request get failed because .toString();
added additional comma of list too
String sCurrentLine = null;
BufferedReader br = new BufferedReader(new FileReader("/home/shubham/git/productApi"));
ArrayList<String> list = new ArrayList<String>();
while ((sCurrentLine = br.readLine()) != null) {
System.out.println(sCurrentLine);
list.add(sCurrentLine);
}
request.payload = list.toString();
System.out.println("dd =" + request.payload);
My JSON
{
"products":
{
"productsApp11": {
"code": "productsApp11",
"name": "productsApp11",
"attribute_set": "one",
"product_type": "product",
"status": "active"
}
}
}
But because of .toString data is coming like below:-
[{,
"products": ,
{,
"productsApp11": {,
"code": "productsApp11",
,
"name": "productsApp11",
,
"attribute_set": "Apparel",
,
"product_type": "product",
,
"status": "active",
},
},
}]
Any solution would be appreciated