What you will learn
Valid JSON can still contain the wrong kind of data. Parsing answers whether the text is readable JSON; field validation answers whether its data satisfies a rule.
Your goals
- Compare valid and malformed JSON.
- Record a wrong-type value accepted by a legacy endpoint.
Before you start
Read the previous lesson first if you have not already. This course does not require programming.
Practice setup
These requests use the public TestKru teaching API. No workspace is needed unless a step says so. Leave the body empty for GET, HEAD and OPTIONS. Example people and emails are fictional. Changes to /api/users are simulated and are not saved.
Follow these steps
- Send the valid echo request. Check the quotes, commas and braces, then select its response. It echoes data. It does not save a user.
- Send the broken text exactly as the step shows it. Select that response and read the message.
- Send the users request whose age is the text twenty, with a valid name and email. Select that response.
- Copy the status of the broken request and the age value that came back. Then choose which layer should reject a wrong type.
- Submit Answers. The simulated /api/users API and the later customer API are different.
Investigate before concluding
First record the actual result for each case. Compare the body, headers and later state with the stated contract. Keep an observation separate from a prediction; use the model answer only after making your own attempt.
What to keep as evidence
- Malformed JSON and wrong-type JSON are different tests.
- Other inputs stay valid to avoid masking the age probe.
- Observed legacy behavior is not silently replaced by an ideal rule.
References for this lesson
Finish this assignment
Select each named response with Use this response. Answer from those responses or the transcript on this page. Click Submit Answers. Your score is the percentage of checks that passed. Core checks are required to finish. Extra evidence checks are labelled. A saved 100/100 means every check passed. Continue opens the next lesson you can submit.
If something goes wrong
- Change one part of the request at a time. If a check needs attention, read the note under it and compare it with the response you selected.
Self-review and independent variation
- Malformed JSON and wrong-type JSON are different tests.
- Other inputs stay valid to avoid masking the age probe.
- Observed legacy behavior is not silently replaced by an ideal rule.
Send numeric age 25 and compare its JSON type with "25".
Automatic checks verify the requests and answers configured for this lesson. The self-review is for your own reasoning. A score is not a certificate.