code
import json
from faker import Faker
import random
from random import randint
fake = Faker('en_US')
for _ in range(1):
sds = {
"id": "AB-asdfaf",
"body": fake.sentence(),
"time": fake.ean(),
"hash": fake.ean(),
"id1": fake.ean(),
"user_id": "asdasdas",
"id3": "test1"
}
print(sds)
output i am getting is in single quotes ''. i need to get the json ijn double quotes
output :
'body': 'Throughout third tough will PM time treat.'
output i need :
"body": "Throughout third tough will PM time treat."
If you expect correct JSON output, you must convert your data explicitly:
print(json.dumps(sds))
It is not only about quotes, False
, True
and None
become false
, true
and null
in JSON.