{ "company":{ "employee":{ "name":"emma", "payble":{ "salary":7000 "bonus":800 } } } }
Solution1:
Python provides The json.tool module to validate JSON objects from the command line. Run the following command.
json.tool
Command: echo "JSON DATA" | python -m json.tool
echo "JSON DATA" | python -m json.tool
echo { "company":{ "employee":{ "name":"emma", "payble":{ "salary":7000 "bonus":800} } } } | python -m json.tool
Output:
Expecting ',' delimiter: line 1 column 68 (char 67)
Just add ',' after "salary":7000 to solve the error.
','
"salary":7000
Solution2:
import json def validateJSON(jsonData): try: json.loads(jsonData) except ValueError as err: return False return True InvalidJsonData = """{ "company":{ "employee":{ "name":"emma", "payble":{ "salary":7000 "bonus":800} } } }""" isValid = validateJSON(InvalidJsonData) print("Given JSON string is Valid", isValid)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Solution1:
Python provides The
json.tool
module to validate JSON objects from the command line. Run the following command.Command:
echo "JSON DATA" | python -m json.tool
Output:
Just add
','
after"salary":7000
to solve the error.Solution2:
need an explanation for this answer? contact us directly to get an explanation for this answer