DEV Community

VICTOR OMONDI
VICTOR OMONDI

Posted on

Convert to JSON in Python vs Javascript

Python:

import json

user = {
    "name": "Victor"
}

json_py = json.dumps(user)
Enter fullscreen mode Exit fullscreen mode

Javascript:

const user = {
    name: "Victor"
}

const jsonJs = JSON.stringify(user);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)