I have a case where I'm being sent a large file with JSON data in it. Unfortunately it has a small line of overhead string data at the start of the file and another line of overhead string data at the end of the file. I was previously reading in the file data manually into a string, and removing this data in memory, but the size has become so large that I can no longer do this.
I now need to use the JSON Object deserializer that reads from a stream, but because of this bloated overhead data this will fail.
So I need to remove this "bloat".
One option is for me to simply rewrite the file, exluding the bloat, then use the new file. However the file is > 1.5GB now and this will add allot of overhead.
A second option is possibly creating an inherited FileStream class that that can hide this bloat, effectively removing the bad overhead data from the stream, while still streaming the remaining data to the JSON deserializer (this seems complex and annoying).
Is there an easy way to do this I am missing before I undertake one of these sort of annoying options?
Example file data...
HDR ZREOF100B 013 20220129 084455
{
"CUSTOMER_DATA": [
... allot of JSON data ...
]
}
TRL ZREOF100B 551
First and last line is basically the "Bloat" I'm referring to.