JNCIA-DevOps Data Serialization Practice Question
Which TWO Python exceptions might be raised when attempting to parse a malformed JSON string using the standard 'json' module? (Choose two)
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
JSONDecodeError
json.loads() raises JSONDecodeError (which inherits from ValueError) when encountering invalid JSON syntax.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
AttributeError
Why it's wrong here
Incorrect. AttributeError occurs when accessing non-existent attributes.
- ✓
JSONDecodeError
Why this is correct
Correct. JSONDecodeError is raised for invalid JSON structure.
- ✗
KeyError
Why it's wrong here
Incorrect. KeyError is raised when looking up missing dictionary keys.
- ✗
ScannerError
Why it's wrong here
Incorrect. ScannerError is raised by PyYAML, not json.
- ✓
TypeError
Why this is correct
Correct. TypeError is raised if the input passed to loads() is not a string, bytes, or bytearray.
About these practice questions
Courseiva writes every JNCIA-DevOps question from scratch — 306 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed August 2026 · checked against the official Juniper Networks exam blueprint
This JNCIA-DevOps practice question is part of Courseiva's free Juniper Networks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the JNCIA-DevOps exam.