The differences between json.dumps and json.loads.

Cameron Simpson cs at cskk.id.au
Fri Sep 13 22:25:30 EDT 2019


On 14Sep2019 02:18, Hongyi Zhao <hongyi.zhao at gmail.com> wrote:
>I'm very confusing on the the differences between json.dumps and
>json.loads.  Any hints?

The direction.

json.dumps takes an object and transcribes it as a string. "Dump to 
string."

json.loads takes a string and decodes it as JSON and returns an object.  
"Load from string".

Cheers,
Cameron Simpson <cs at cskk.id.au> (formerly cs at zip.com.au)



More information about the Python-list mailing list