csv-to-custom-json-python

How to install
python3 -m pip install csv-to-custom-json
Tests && coverage
Coverage is 100%
# install
python -m pip install coverage unittest
# only test
python -m unittest
# coverage
coverage run -m unittest && coverage report -m
How to use csv-to-custom-json
Classic usage
Just import the function and use it !
from csv_to_custom_json import parseFile
result = parseFile("myfile.csv")
How to use the schema
Create a schema variable and put it as second parameter !
Example with a simple csv :
num1,num2,num3
1,2,3
4,5,6
7,8,9
from csv_to_custom_json import parseFile
def callback(value):
return None
schema = {
"num1": "string",
"num2": callback,
"num3": "int"
}
result = parseFile("myfile.csv", schema)
Caption :
- ad you can see the schema can contains function, or string with the type
- the values with type will be parsed
- attribute of the object are the word in the first line of the csv
More complexe schema
It's the same as a simple schema :
from csv_to_custom_json import parseFile
schema = {
"obj1": {
"obj2": {
"num4": "string"
}
},
"num2": "",
"num3": ""
}
result = parseFile("myfile.csv", schema)
If you want to check some real case, check out the folder test in the GitHub repository
If you want to see and use options check that documentation: How-to-options
See also
License
Licensed under the MIT License - LICENSE
Metadata
Release files for csv-to-custom-json 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| csv_to_custom_json-1.0.0.tar.gz | 9.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| csv_to_custom_json-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.2 kB
Release files / csv_to_custom_json-1.0.0.tar.gz
| Download URL | csv_to_custom_json-1.0.0.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5ce05249329453f11fb406984a033b915eb41681e4694de411c4420c9311f4e
|
|
BLAKE2b-256 checksum How to use checksums |
7d8fc32632498dcc670dc1788e15b9e0b57418f0c5126b172cf486d03d4198f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.12
|
Release files / csv_to_custom_json-1.0.0-py3-none-any.whl
| Download URL | csv_to_custom_json-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed911d49709159cc8838075ef0d573ee3901319c2b61467091d99a26fdcf8cdb
|
|
BLAKE2b-256 checksum How to use checksums |
16e4549907b211dad94f98f796e52aef7f71fe457f766e954a82223bae4e51ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.12
|
Security for csv-to-custom-json 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.