convert to json python

JavaScript
import json

x = {
  "name": 
  "John",
  "age": 30,
  "city": "New York"
}

y = json.dumps(x)
Source

Also in JavaScript: