Problem Statement
Which statement about json vs pickle is correct for APIs?
Explanation
JSON is language-neutral and safe when parsed with standard libraries. pickle can execute code on load and must not be used with untrusted inputs.
Use JSON for API payloads, with custom encoders for datetimes when needed.
Code Solution
SolutionRead Only
import json
payload=json.dumps({'ok':True})Practice Sets
This question appears in the following practice sets:
