-
Notifications
You must be signed in to change notification settings - Fork 373
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
I’m a bit surprised that the Python generator doesn’t import json (which is a part of stdlib), and generate JSON payloads as regular dictionaries, instead of hard to read (and edit) already encoded strings.
Describe the solution you'd like
Just import json on top, and then you can do something like:
#!/usr/bin/env python
import json
current_payload = '{"a": 1, "b": "some \\n string"}'
better_dict_payload = {
'a': 1,
'b': 'some \n string'
}
future_payload = json.dumps(better_dict_payload)
print('current =', current_payload)
print('future =', future_payload)
print('equal? ', current_payload == future_payload)resulting in:
current = {"a": 1, "b": "some \n string"}
future = {"a": 1, "b": "some \n string"}
equal? True
Now, better_dict_payload is much-much more readable, and easy to edit.
Additional context
n/a
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request