Metadata-Version: 2.1
Name: csv-to-custom-json
Version: 0.0.4
Summary: Easily convert your CSV to custom JSON
Author-email: n4n5 <its.just.n4n5@gmail.com>
License: MIT License
        
        Copyright (c) 2021 n4n5
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/its-just-nans/csv-to-custom-json-python
Project-URL: Bug Tracker, https://github.com/its-just-nans/csv-to-custom-json-python/issues
Keywords: csv,custom_json,custom-json,json,csv-to-json,csv_to_json,convert,convert-json,convert_json,convert-to-json,convert_to_json,to-json,to_json,csv-to-custom-json,csv_to_custom_json
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# csv-to-custom-json-python

- [PyPi page](https://pypi.org/project/csv-to-custom-json/)
- [PyPiStats](https://pypistats.org/packages/csv-to-custom-json)

## How to install

- [installation docs](https://github.com/Its-Just-Nans/csv-to-custom-json-python/tree/master/docs/How-to-install.md)

```sh
python3 -m pip install csv-to-custom-json
```

## Tests && coverage

Coverage is 100%

```sh
# 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 !

```python
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 !

Exemple with a simple `csv` :

```csv
num1,num2,num3
1,2,3
4,5,6
7,8,9
```

```python
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 :

```python
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](https://github.com/Its-Just-Nans/csv-to-custom-json-python)

If you want to see and use options check that documentation: [How-to-options](https://github.com/Its-Just-Nans/csv-to-custom-json-python/tree/master/docs/How-to-options.md)

## See also

- [Tricks](https://github.com/Its-Just-Nans/csv-to-custom-json-python/tree/master/docs/How-to-know-more.md)
- [How-to-options](https://github.com/Its-Just-Nans/csv-to-custom-json-python/tree/master/docs/How-to-options.md)
- [CHANGELOG.md](https://github.com/Its-Just-Nans/csv-to-custom-json-python/tree/master/CHANGELOG.md)
- [csv-to-custom-json in JavaScript](https://github.com/Its-Just-Nans/csv-to-custom-json)

## License

Licensed under the MIT License - [LICENSE](LICENSE)
