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
Create a schema variable and put it as second parameter !
44
+
45
+
Exemple with a simple `csv` :
46
+
47
+
```csv
48
+
num1,num2,num3
49
+
1,2,3
50
+
4,5,6
51
+
7,8,9
52
+
```
53
+
54
+
```python
55
+
from csv_to_custom_json import parseFile
56
+
57
+
defcallback(value):
58
+
returnNone
59
+
60
+
schema = {
61
+
num1: "string",
62
+
callback,
63
+
num3: "int"
64
+
}
65
+
66
+
result = parseFile("myfile.csv", schema)
67
+
```
68
+
69
+
> Caption :
70
+
>
71
+
> - ad you can see the schema can contains function, or string with the type
72
+
> - the values with type will be parsed
73
+
> - attribute of the object are the word in the first line of the csv
74
+
75
+
## More complexe schema
76
+
77
+
It's the same as a simple schema :
78
+
79
+
```python
80
+
from csv_to_custom_json import parseFile
81
+
82
+
schema = {
83
+
obj1: {
84
+
obj2: {
85
+
num4: "string"
86
+
}
87
+
},
88
+
num2: "",
89
+
num3: ""
90
+
}
91
+
result = parseFile("myfile.csv", schema)
92
+
```
93
+
94
+
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)
95
+
96
+
If you want to see and use options check that documentation: [How-to-options](./docs/How-to-options.md)
97
+
98
+
## See also
99
+
100
+
-[Tricks](./docs/How-to-know-more.md)
101
+
-[How-to-options](./docs/How-to-options.md)
102
+
9
103
## License
10
104
11
-
Licensed under the MIT License - [LICENSE](LICENSE)
105
+
Licensed under the MIT License - [LICENSE](LICENSE)
0 commit comments