Write a function that parses a JSON string.
The function should handle one of the three errors below:
- Invalid JSON: The input string is not valid JSON.
- Missing keys: The JSON object is missing expected keys.
- Incorrect data types: The values associated with keys have unexpected data types.
The JSON should have the keys food (string), category (string value of either Asian or Western), and price (integer).
The function should return a dictionary containing the parsed data if successful, or a string error message specifying exactly one of the three categories of errors above.
Possible error strings:
Invalid JSONMissing keysIncorrect data types
Note: Each test will only have one error, so don’t worry about ordering which error should take precedence.
This problem asks you to parse a JSON string and return either the parsed dictionary or one of three exact error messages. The solution is straightforward: first try json.loads to detect invalid JSON, then verify that all required keys are present, and finally validate each field’s type and allowed value constraints. The important part is to separate missing keys from incorrect data types and return the correct message for each case. It is a simple but careful input-validation task that tests JSON parsing, dictionary checks, and type validation.