I need to read a csv file, which has one header and one cell of data, which is in JSON format. Need to read the JSON data (from that cell) and convert it into dataframe using R. Though I found a similar question online, but I do not find a working solutions. Pls help. I tried the below code, but it didnt work, no idea what I miss here.
install.packages("rjson")
library(rjson)
myData <- read.csv("sampleData.csv", nrows=1,skip = 1)
json_data_frame <- as.data.frame(myData)
dat_r = toJSON(myData)
dat_c = toJSON(myData)
dat_v = toJSON(myData)
Data in that cell:
{
"sample": {
"leadID": "",
"branchID": "",
"leadType": "",
"fundingType": "",
"createdDate": "",
"outFlowDetails": [
{
"customersub_cat": "",
"repayableInMonths": ,
"amountRequested": ,
"financeAmount": ,
"moratorium": ,
"emiPattern": "",
"emiLtv": ,
"netAssetCost": ,
"vehicleDetail": {
"YOM": ,
"manufactureID": "",
"makeID": "",
"modelID": "",
"schemeID": "",
"vehicleType": "",
"isPreDelivered": ,
"agreementNo": "",
"noOfOwners":
}
},
{
"customersub_cat": "",
"repayableInMonths": ,
"amountRequested": ,
"financeAmount": ,
"moratorium": ,
"emiPattern": "",
"emiLtv": ,
"netAssetCost": ,
"vehicleDetail": {
"YOM": ,
"manufactureID": "",
"makeID": "",
"modelID": "",
"schemeID": "",
"vehicleType": "",
"isPreDelivered": ,
"agreementNo": "",
"noOfOwners":
}
}
],
"priorVehicleSummary": {
"fleetSize": ,
"noOfFreeVehicle": ,
"vehicleAddedLastOneYear":
},
"partyDetails": [
{
"partyID": "",
"partyType": "",
"coBorrowerRelationship": "",
"age": ,
"customerType": "",
"category": "",
"negativeList": "",
"negativeArea": "",
"industry": "",
"natureOfBuisness": "",
"trustingSocialScore": "",
"SherlockRules": [
"",
"",
"",
"",
""
],
"documents": [
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
}
],
"properties": [
{
"ownership": ""
},
{
"ownership": ""
}
],
"occupation": {
"businessNature": "",
"yearsInBusiness":
},
"addressDetails": [
{
"CurrentAddress":
},
{
"CurrentAddress":
},
{
"CurrentAddress":
}
],
"ScoreSG_": {
"Length": "",
"ScoreName": "",
"ScoreCardName": "",
"ScoreCardVersion": "",
"ScoreDate": "",
"Score": "",
"reason1FL": "",
"reason1": "",
"reason2FL": "",
"reason2": "",
"reason3FL": "",
"reason3": "",
"reason4FL": "",
"reason4": "",
"reason5FL": "",
"reason5": ""
},
"acc": [
{
"Length": "",
"SG_Tag": "",
"acc_Summary_SG__Fields": {
"ShrtNameFL": ""
},
"acc_NonSummary_SG__Fields": {
"ShrtNameFL": "",
"ShrtName": "",
"accType": "",
"OwnershipIndicator": "",
"DateOpenedOrDisbursed": "",
"DateOfLastPayment": "",
"DateReportedAndCertified": "",
"AmtFL": "",
"Amt": "",
"CB_FL": "",
"CB_": "",
"LastPaid1FL": "",
"LastPaid1": "",
"LastPaidStartDate": "",
"LastPaidEndDate": "",
"CL_FL": "",
"CL_": ""
}
}
],
"Enq": [
{
"Length": "",
"SG_Tag": "",
"DateOfEnqFields": "",
"EnquiringMemberShortNameFL": "",
"EnquiringMemberShortName": "",
"EnqPurpose": "",
"EnqAmountFL": "",
"EnqAmount": ""
}
]
},
{
"partyID": "",
"partyType": "",
"coBorrowerRelationship": "",
"age": ,
"customerType": "",
"category": "",
"negativeList": "",
"negativeArea": "",
"industry": "",
"natureOfBuisness": "",
"trustingSocialScore": "",
"SherlockRules": [
"",
"",
"",
"",
""
],
"documents": [
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
},
{
"sub_cat": "",
"ProofValue": ""
}
],
"properties": [
{
"ownership": ""
},
{
"ownership": ""
}
],
"occupation": {
"businessNature": "",
"yearsInBusiness":
},
"addressDetails": [
{
"CurrentAddress":
},
{
"CurrentAddress":
},
{
"CurrentAddress":
}
],
"ScoreSG_": {
"Length": "",
"ScoreName": "",
"ScoreCardName": "08",
"ScoreCardVersion": "10",
"ScoreDate": "21102020",
"Score": "00622",
"reason1FL": "02",
"reason1": "04",
"reason2FL": "02",
"reason2": "32",
"reason3FL": "02",
"reason3": "28",
"reason4FL": "02",
"reason4": "31",
"reason5FL": "02",
"reason5": "29"
},
"acc": [
{
"Length": "04",
"SG_Tag": "T001",
"acc_Summary_SG__Fields": {
"ShrtNameFL": "13"
},
"acc_NonSummary_SG__Fields": {
"ShrtNameFL": "13",
"ShrtName": "NOT DISCLOSED",
"accType": "10",
"OwnershipIndicator": "1",
"DateOpenedOrDisbursed": "09012020",
"DateOfLastPayment": "07082020",
"DateReportedAndCertified": "20082020",
"AmtFL": "05",
"Amt": "77159",
"CB_FL": "01",
"CB_": "0",
"LastPaid1FL": "21",
"LastPaid1": "000000000XXX000000000",
"LastPaidStartDate": "01082020",
"LastPaidEndDate": "01022020",
"CL_FL": "05",
"CL_": "80000"
}
}
],
"Enq": [
{
"Length": "04",
"SG_Tag": "I001",
"DateOfEnqFields": "26022020",
"EnquiringMemberShortNameFL": "13",
"EnquiringMemberShortName": "NOT DISCLOSED",
"EnqPurpose": "02",
"EnqAmountFL": "07",
"EnqAmount": "3500000"
}
]
}
]
}
}