Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm intending to have few of my columns in my dataset to be in JSON format, for grouping purposes, but the general CSV format is preserved (or whatever delimiter).
Is there a Java library that can process, parse, read, write CSVs that has columns as JSON?
I don't know of any library that can do this. However, it is simple enough to use your go to CSV library, e.g. Commons CSV and run the value string through Jackson or Gson.
However, I would recommend using JSON lines as a substitute for CSV. This can be parsed nicely out of the box with Jackson or Gson. You would end up with CSV like files like this:
["Name", "Session", "Score", "Completed", "some object"]
["Gilbert", "2013", 24, true, {"foo": "bar"}]
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 days ago.
Improve this question
I want to parse a pdf which is having a table. But, couldn't find any library(in java) which could read a pdf in a format in which it appears.
Basically, the existing libraries read a table just as a string without preserving the format. So, what is the best way to parse it and get the list of key value pairs in java?
Pdf screenshot sample
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
What is the fastest way to construct target messages from source messages by mapping file?
Such integration tasks are usual for business applications, but i dont know any universal approach for it. Coding them with objects mapping libs (like MapStruct or ModelMapper) - its wasting developer time, its mindless routine, isn't so?
This work can be successfully done by analyst: create any simple data mapping in json, send to integration service and check target message format.
But for this purpose i've found only big and not-free solutions like Altova MapForce (modeler&server) or IBM Integration Bus data graphical editor.
How do you solve such tasks in your projects?
UPDATE
Mapping format, we choosed for our issue (incl. nesting, arrays, rules):
{
"camunda.Form": {
"blockA": {
"FullName": "QuestionareResEntity.FullName.data",
"RTOPA1TF": "QuestionnaireResEntity.ResTypeOfPaymentAgents.data || CONTAIN || ID1",
"RTOPA2TF": "QuestionnaireResEntity.ResTypeOfPaymentAgents.data || YOUR_RULE || Param1,Param2,Param3",
},
"blockB": {
"ColExMan": "InfoAboutGovernment.CollegialExecutiveManagement.data || DICT || CollegialExecutiveManagementDictionary"
},
"LEResColManag.row[].cells": {
"FName": "TableLERes3[].FullName.data",
"Citiz": "TableLERes3[].Citizenship.data",
"RegAddress": "TableLERes3[].RegistrationAdress.data",
}
}
}
How does it seem for you by convenience and readability?
Appreciate your thoughts and ideas.
You can convert JSON to XML by free automatic converters. Then use the classic way with XSLT and XPath on the converted XML to convert the data in a similar way as you have listed. A lot of free tools, graphical editors and librarys are out there for XML.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Say I have the following bits of XML:
<string>&</string>
<string>&</string>
Is there a Java XML parsing API that will preserve them as is when reading them?
I've explored SAX, DOM, and am currently on StAX. They all convert the references before they feed me the character data.
Thanks!
To the best of my knowledge the answer is no (though proving the non-existence of a piece of software is difficult).
If this is really a requirement (and I'm sceptical), then I would suggest preprocessing the input to replace &# by, say, §#, perhaps choosing § from the Unicode private use area if you want to be ultra-cautious.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
guys i saw these couple of codes while i was browsing on the net. when i read the the whole content it says that these codes are for creating a data file for storing an inputs such as Employee information or registered accounts etc. can anyone please give me an example for this?
backupRecords();
outputstream = new DataOutputStream(new FileOutputStream("data.dat"));
reWriteRecords(outputstream);
inputstream = new DataInputStream(new FileOutputStream("temp.dat"));
I am writing this answer assuming that you wanted to know hot the contents of the input file look like.
The easy answer would be something like this:
data.txt:
Yuri;Gagarin;Russia;52;Male
Booch;Gary;USA;40;Male
Randy;Orton;USA;52;Male
Anna;Tereshkova;Russia;40;Female
Maria;Sharapova;Russia;32;Female
Notice the delimiter ';'. The java code after opening the file for reading, reads the contents of the file and would be written under the assumption that each occurrence of the delimiter ';' gives a piece of information. For example, FirstName or LastName or Country or Age or Gender.
The better solution for reading data is xml.
data.xml:
<PersonInfo>
<FirstName>Yuri</FirstName>
<LastName>Gagarin</LastName>
<Country>Russia</Country>
<Age>52</Age>
<Gender>Male</Gender>
....
</PersonInfo>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I have a "|" separated data file. Need to transfer it to csv format.
In csv I have 9 columns. And the data is in format:
257|30|1666|4906|3712|1|1.00|4.99|1.04|2|27.28|2.00|4.92|1|4.99|1.00|1.04|9|0.222222|0.000000|0.111111|-1.000000
254|1|1578|3713|4900|1|1.00|1.99|1.26|16|53.30|25.00|12.23|39|125.30|55.00|62.48|320|0.050000|0.000000|0.003125|0.000000
256|38|227|25303|25306|1|1.00|11.99|1.99|1|6.99|1.00|1.67|7|62.28|9.00|9.08|16|0.062500|1.000000|0.062500|0.000000
is there a built functions? What do you advise to use?
Thanks
If you use an inputstream to read from your data file and replace every occurrence of the pipe symbol with a comma and you use an output stream to write back you will be a happy man. you can use every 9th pipe as some sort signal to move your output to a new line. That's like 10 lines of code