You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add JsonFileUpdater class for simplifying worfking with json files.
file.json:
{
'hello': 'world'
}
f = JsonFileUpdater('file.json')
f['hello'] # 'world'
f['hi'] = 12
file.json after this code:
{
'hello': 'world',
'hi': 12
}
Also i suggest add support for with operator (json.loads -> change keys with [] operator -> json.dumps and write):
with f:
f['hi'] = 12
f['hello'] = 34.2
Also i suggest add support for custom loads() and dumps() functions and for indent (if custom loads() or dumps() are provided, they must support indent argument).
f = JsonFileUpdater('file.json', loads=ujson.loads, dumps=ujson.dumps)
f2 = JsonFileUpdater('file.json', indent=4)
The text was updated successfully, but these errors were encountered:
Add
JsonFileUpdater
class for simplifying worfking with json files.file.json
:file.json
after this code:Also i suggest add support for
with
operator (json.loads -> change keys with[]
operator -> json.dumps and write):Also i suggest add support for custom
loads()
anddumps()
functions and for indent (if customloads()
ordumps()
are provided, they must supportindent
argument).The text was updated successfully, but these errors were encountered: