Trying to load a file with json string, below is my code, it's working fine with other files but only issue with this file. checked in json lint also, no issues json string is valid.i tried all the solutions for other similar kind of questions but no luck
from jsonkeyvalue import find
import json
from xlutils.copy import copy
from xlrd import open_workbook
from xlwt import easyxf
rb = open_workbook('Login_updated.xls',formatting_info=True)
r_sheet = rb.sheet_by_index(1)
wb = copy(rb)
w_sheet = wb.get_sheet(1)
module = ['Login','Dashboard']
keyword = ['getText']
with open('data_french.json') as data_file:
j = json.load(data_file)
for row in range(r_sheet.nrows):
if((r_sheet.cell(row,0).value in module) & (r_sheet.cell(row,3).value in keyword)):
w_sheet.write(row,13, str(find(r_sheet.cell(row,4).value,j)))
wb.save("Login_updated.xls")
Error msg:
Traceback (most recent call last):
File "C:\Users\vbabu\Desktop\Resource Bundle\getvaluefrmjson.py", line 18, in <module>
j = json.load(data_file)
File "C:\Python27\lib\json\__init__.py", line 290, in load
**kw)
File "C:\Python27\lib\json\__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\lib\json\decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
[Finished in 0.7s with exit code 1]
JSON Sample:
{
"app": {
"Flower": {
"label": {
"red_flower": "Nite queen",
"white_flower": "grce reward",
"green_flower": "Marigold",
"yellow_flower": "jasmine",
"blue_flower": "shoe flower",
"maroon_flower": "marigold"
}
},
"title": {
"initialLabel": "dl",
"policyLabel": "pq",
"advertiseLabel": "cp",
"granitePage": "grace",
"positonPage": "MuskVan",
}
}
}
答案 0 :(得分:3)