I am connecting the mongodb database via pymongo and achieved the expected result of fetching it outside the db in json format . but my task is that i need to create a hive table via pyspark , I found that mongodb provided json (RF719) which spark is not supporting .when i tried to load the data in pyspark (dataframe) it is showing as corrupted record. . and if any possible ways of converting the json format in python is also fine ..Please suggest a response
mport json with open('D:/json/aaa.json') as f: d = f.read() da = ''.join(d.split()) print(type(da)) print(da) daa=da.replace('u'','') daaa= json.loads(daa) print(daaa)
satisfied with the answer. Hence closing this question
unable to read the mongodb data (json) in pyspark