Browse Source

Added JSON serialize

pull/3/head
Jure Šorn 6 years ago
parent
commit
5308fb97e8
1 changed files with 7 additions and 1 deletions
  1. 8
      README.md

8
README.md

@ -429,6 +429,12 @@ JSON
import json import json
``` ```
### Serialize/Deserialize
```python
<str> = json.dumps(<object>)
<object> = json.loads(<str>)
```
### Read File ### Read File
```python ```python
with open(filename, encoding='utf-8') as file: with open(filename, encoding='utf-8') as file:
@ -438,7 +444,7 @@ with open(filename, encoding='utf-8') as file:
### Write to File ### Write to File
```python ```python
with open(filename, 'w', encoding='utf-8') as file: with open(filename, 'w', encoding='utf-8') as file:
json.dump(<object>, file) # Or: file.write(json.dumps(<object>))
json.dump(<object>, file)
``` ```
SQLite SQLite

Loading…
Cancel
Save