0

I am extracting a large quantity of data from a Database in JSON format. 3 Million + rows, the resulting text file weighs ~4GB. I wish to split the resulting JSON file into one JSON file per "DATE_JR".

The schema looks like this:

{
"ID": "ABC000011512221",
"DATE_JR": "2017-04-01",
"TYPE": "Balloon",
"XELL": "AB-123",
"QRSX": "QRSXA",
"CAT1": "1st one",
"CAT2": "2nd one",
"CAT3": "3rd one",
"CODE_MUK": "Some Code",
"DATE_HR": "2017-04-01 19:27:38",
"GEO_LONG": "-87.5060503076923",
"GEO_LAT": "62.2202423846154"
}

The Data is Ordered by ID, which is also an ID generated in chronological order, so DATE_JR and DATE_HR also ordered.

I saw this code : https://stackoverflow.com/a/41505542/4254078 from @Ansgar Wiechers which looks close to what I need but not quite.

Some PowerShell Guru could shed some light?

3
  • 1
    Please shows us what you've tried so far and how the output files should be named. As a general pointer: please read about how to ask a good question. Commented Apr 29, 2019 at 21:10
  • What do you mean when you say close to what I need but not quite about Ansgars answer? Why does that not work for you? Commented Apr 30, 2019 at 13:22
  • So um, The output of my extract is exactly as this : [ { Stuff }, { Stuff } ] No text before the data, no "Type" or "Feature". So in his code .... Select-Object -Expand features | ... } -Expand Features : I have nothing to expand then after I am simply at a loss. I understand variables ($xxxx) Starting to get a hold of "Foreach", but how is each-object different ? "-f ($i++)" and after ? No signal in the brain XD I want to split my json data (Many days worth of data) into 1 file per day : 2019-01-01.json, 2019-01-02.json, etc ... Thanks! Commented May 2, 2019 at 21:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.