A
A
Apstrew2021-02-24 22:57:13
JSON
Apstrew, 2021-02-24 22:57:13

Why, after running json-concat, the output contains the contents of only one json, and not all jsons in the folder?

Hello!

I want to stitch all json's in a folder. Just objects next to each other.
Made a folder with test objects a.json, b.json and c.json with the same structure. Here is the start of a.json:

[
 {
   "header": "a1",
   "date": "a2",
   "body": "a3",
   "link": "a4"
 },
 {
   "header": "b1",
   "date": "b2",
   "body": "b3",
   "link": "b4"
 },


In b.json, everything is done the same, but the letters of the alphabet are double. In c.json - triple I run

the following most primitive script in the folder with these objects, almost a copy-paste from the documentation:
var jsonConcat = require("json-concat");
 
jsonConcat({
  src: "./Testjoin/",
    dest: "./Testjoin/result.json"
}, function (json) {
    console.log('done');
});


I'll never know - for some reason, in the output json'e there are no stitched objects, but only c.json content, for example. Or b.json. Obviously - the one that went to the script last.

I want to get sequentially stitched (the order is not important) the contents of a, b and c

Tell me where to dig?
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question