A script must call a vendor's REST API, reshape the nested JSON response into rows, and load those rows into a database table on a schedule. Which language and approach is the best fit?
Select an answer to reveal the explanation.
Short Explanation
Think of Python as the Swiss Army knife for data plumbing: fetch it, reshape it, load it, all in one readable script. Mature libraries handle each step, so you're not reinventing anything. The trap is regex on JSON, which works right up until the vendor reorders a field.
Full Explanation
Python is widely used for data-wrangling automation because each stage of this pipeline has a well-established library: an HTTP client to call the REST API and handle authentication and errors, the built-in JSON module or a data library such as pandas to flatten nested structures into rows, and a database driver to insert those rows with parameterized statements. The script can then run on a scheduler on a server. Parsing JSON with regular expressions treats structured data as plain text; it breaks when the vendor adds whitespace, reorders keys, escapes characters or nests values differently, so it is fragile compared with a real JSON parser. Piping a raw API response directly into a table from a shell script skips the reshaping step entirely; nested JSON does not map to rows without transformation, and a shell pipeline offers little structured error handling. Client-side JavaScript runs in users' browsers, which is the wrong runtime location for a scheduled server task, and it would require exposing database access to the client. Exam caveat: other languages can do this job, but Python's role in the objectives is data manipulation and integration with databases, and that is what the scenario tests. Operational check: run the script against a sample API response, confirm the row count and column values match the source records, and verify that a malformed response is logged as an error rather than partially loaded.