I have a json file that I have to push into MongoDB. There are segments of data that are differently encoded. Like
{
"Type":"File",
"Start_Time":"2017-08-07T22:15:16.147Z",
"Finish_Time":"2017-08-07T22:15:16.147Z",
"Format":"UTF-16LE",
"Message":"*' ¾Ò ,'H EÌ1Ò (F\/Ò ©Ì -A'8* ©1H ,( *ÌF ('1 ~‘¾*'¾Ò *H'DDG ~'© A14* ",
"Name_DB":"Main"}
And
{
"Type":"File",
"Start_Time":"2017-08-07T22:16:51.462Z",
"Finish_Time":"2017-08-07T22:16:51.462Z",
"Format":"ASCII",
"Message":"SMS_CC_NR-InternType ISDN_NP +923330051108 From: UnkNumb Alphanumeric NR:EVC@ TID: 1123103757111462, Dear Retailer, U have successfully recharged 49 Rupee to 03325047863.Your current balance is 11257.00 Rupee.",
"Name_DB":"Main"
}
When I try to read the file, it throws a codec error. As you can see the two chunks have different formats - utf-16LE
and ASCII
.
How do I read this file?