I have two ways to represent Python object by json.dumps()
First:
person = {
"name": "John",
"age": 30,
"city": "New York"
}
Second:
class Person:
def _init_(self, name, age, city):
self.name = name
self.age = age
self.city = city
person = Person("John", 30, "New York")
Then I tried p1 = json.dumps(person), the second way would say it's not JSON serializable.
So basically for Python, json.dumps only work for built-in object like dict object?