Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jerryshell/csv2jsonobj
CSV to JSON Object
https://github.com/jerryshell/csv2jsonobj
csv json rust
Last synced: 30 days ago
JSON representation
CSV to JSON Object
- Host: GitHub
- URL: https://github.com/jerryshell/csv2jsonobj
- Owner: jerryshell
- License: agpl-3.0
- Created: 2024-05-09T07:43:39.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-12-21T21:41:24.000Z (about 2 months ago)
- Last Synced: 2024-12-21T22:26:10.297Z (about 2 months ago)
- Topics: csv, json, rust
- Language: Rust
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CSV to JSON Object
Well, it is what it sounds like.
## How to use
```bash
cargo install --locked --git https://github.com/jerryshell/csv2jsonobj
``````bash
csv2jsonobj [key_index]
````key_index` is optional, default is 0
## Example
```bash
$ cat example.csv
id,name,equiment_slot,stackable,attack,defense,block
sword,Sword,MainHand,FALSE,60,0,0
shield,Shield,OffHand,FALSE,0,100,25
steel_helmet,Steel Helmet,Head,FALSE,0,80,0
leather_armor,Leather Armor,Chest,FALSE,0,110,0
jagged_arrow,Jagged Arrow,Projectiles,TRUE,20,0,0$ csv2jsonobj example.csv > output.json
$ cat output.json
{
"jagged_arrow": {
"attack": 20.0,
"block": 0.0,
"defense": 0.0,
"equiment_slot": "Projectiles",
"id": "jagged_arrow",
"name": "Jagged Arrow",
"stackable": true
},
"leather_armor": {
"attack": 0.0,
"block": 0.0,
"defense": 110.0,
"equiment_slot": "Chest",
"id": "leather_armor",
"name": "Leather Armor",
"stackable": false
},
"shield": {
"attack": 0.0,
"block": 25.0,
"defense": 100.0,
"equiment_slot": "OffHand",
"id": "shield",
"name": "Shield",
"stackable": false
},
"steel_helmet": {
"attack": 0.0,
"block": 0.0,
"defense": 80.0,
"equiment_slot": "Head",
"id": "steel_helmet",
"name": "Steel Helmet",
"stackable": false
},
"sword": {
"attack": 60.0,
"block": 0.0,
"defense": 0.0,
"equiment_slot": "MainHand",
"id": "sword",
"name": "Sword",
"stackable": false
}
}
```## Test
```bash
cargo test
```## License
[GNU Affero General Public License v3.0](https://choosealicense.com/licenses/agpl-3.0)