Stream does not return JSON array
See original GitHub issueHi, first of all thank you for the great lib.
I have an issue to parse a CSV using the streaming API because it does not return a JSON array. I don’t know if it is the “normal” behavior but here an example to explain my problem (with Node v0.12):
The original CSV file:
annee;jour;date;b_1;b_2;devise;
2015029;LUNDI ;09/03/2015;35;31;eur;
2015028;SAMEDI ;07/03/2015;48;9;eur;
The code to parse the CSV:
var rs = require('fs').createReadStream('source.csv');
var ws = require('fs').createWriteStream('destination.json');
rs.pipe(new Converter({ constuctResult: false, delimiter: ';', trim: true })).pipe(ws);
The result file content:
{"annee":2015029,"jour":"LUNDI","date":"09/03/2015","b_1":35,"b_2":31,"devise":"eur","":""}
{"annee":2015028,"jour":"SAMEDI","date":"07/03/2015","b_1":48,"b_2":9,"devise":"eur","":""}
I would expected to have this json object:
[
{"annee":2015029,"jour":"LUNDI","date":"09/03/2015","b_1":35,"b_2":31,"devise":"eur","":""},
{"annee":2015028,"jour":"SAMEDI","date":"07/03/2015","b_1":48,"b_2":9,"devise":"eur","":""}
]
It works fine if I use the end_parsed
event instead, but not with the stream and the pipe
API.
Thank you for your help
Note: I don’t know why by it adds me an empty field in the JSON result too
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Java 8: How to write lambda stream to work with JsonArray?
Try with IntStream. List<String> jsonObject = IntStream .range(0,jsonArray.size()) .mapToObj(i -> jsonArray.
Read more >javax.json.JsonArray.stream java code examples - Tabnine
Returns a list view for the array. The value and the type of the elements * in the list is specified by the...
Read more >JSONStreams (Java Application API for IBM Streams)
A JSON stream is a stream of JSON objects represented by the class com.ibm.json.java.JSONObject . When a JSON value that is an array...
Read more >JSONArray (Apache Wink 1.2.0-incubating API)
Create a new instance of this class from the data provided from the input stream. JSONArray(InputStream is, boolean strict) Create a new instance...
Read more >3 techniques to stream JSON in Spring WebFlux
Returning large JSON arrays from WebFlux endpoint is a challenge. Assume you have a Flux<Data> that you want to return. We have at...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, I just released ver 0.3.19 which includes the toArrayString feature. Try
This should do what you expect.
Regards, Keyang
It works perfectly, thank you very much for your reactivity!