Новый перевод английской версии сайта
This commit is contained in:
+10
-10
@@ -1,34 +1,34 @@
|
||||
### Working with JsonManager
|
||||
|
||||
This class is designed to write and extract information from json files.
|
||||
This class is intended for writing and retrieving information from JSON files.
|
||||
|
||||
JsonManager takes only one argument — the encoding in which the files will be read. The default is UTF-8.
|
||||
JsonManager accepts only one parameter: encoding — the encoding in which the files will be read (default is UTF-8).
|
||||
|
||||
```py
|
||||
from ipars import JsonManager
|
||||
|
||||
j = JsonManager()
|
||||
j = JsonManager(encoding="UTF-8")
|
||||
```
|
||||
|
||||
### Brief Overview of JsonManager Methods
|
||||
|
||||
1. The **load** method is used to retrieve data from a JSON file at the specified path.
|
||||
- The **load** method is used to obtain data from a JSON file at the specified path.
|
||||
|
||||
2. The **dump** method is used to write data to a JSON file. It takes the path to the file and the data to be written.
|
||||
- The **dump** method is used to write data to a JSON file. It accepts the file path and the data to write.
|
||||
|
||||
3. The **pprint** method is the same as that of Pars.
|
||||
- The **pprint** method is the same as that of Pars.
|
||||
|
||||
### Example of Using JsonManager
|
||||
### Example Usage of JsonManager
|
||||
|
||||
```py
|
||||
|
||||
from ipars import JsonManager
|
||||
j = JsonManager()
|
||||
nameFile = 'data.json'
|
||||
|
||||
# Writing data
|
||||
j.dump('./data.json', [1, 2, 3, 4, 5, 6, 7])
|
||||
j.dump(nameFile, [1, 2, 3, 4, 5, 6, 7])
|
||||
|
||||
# Retrieving data
|
||||
data = j.load('./data.json')
|
||||
data = j.load(nameFile)
|
||||
j.pprint(data) # [1, 2, 3, 4, 5, 6, 7]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user