Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I need a script that can combine multiple JSON files (each file contains one large object) into a separate document containing a single array of all objects from each of the original documents.

What I have tried:

I need a script that can combine multiple JSON files (each file contains one large object) into a separate document containing a single array of all objects from each of the original documents.
Posted
Updated 6-Apr-17 8:28am
v3
Comments
[no name] 6-Apr-17 9:30am    
We aren't a write-code-to-order service.
Richard Deeming 6-Apr-17 13:08pm    
So go ahead and write one. You have our permission.

And stop "bumping" your not-a-question up the list. It's extremely rude, and will only end up getting you kicked off the site for abuse.
ZurdoDev 6-Apr-17 14:17pm    
Do you have a specific question?

1 solution

You should try the jq tools (jq-json-processor) in shell script to parse json.

Github repository found here
[^]

Online Tool found here
[^]

You need something along the lines of:

jq -s '.[0] * .[1]' file1 file2


which will recursively merge two files into one.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900