Difference between "json" and "simplejson" modules?

Asked 2 years ago, Updated 2 years ago, 57 views

There are many projects to import simplejson modules instead of json modules What's the difference between you two? Why do you import and use such different modules instead of standard library functions?

json python simplejson

2022-09-22 22:24

1 Answers

json is simplejson in stdlib. There's not much difference between the two

Since json was not added until 2.6, simplejson is compatible with other Python versions, so simplejson is more used And simplejson is updated more often.

Personally, when I write a module related to json, We recommend that you write json when you cannot write simplejson.

When importing, please write as follows.

try: import simplejson as json
except ImportError: import json


2022-09-22 22:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.