https://github.com/arthur87/asa_json
asa_json is a library for conveniently JSON
https://github.com/arthur87/asa_json
csv gem json jsonl ruby
Last synced: about 2 months ago
JSON representation
asa_json is a library for conveniently JSON
- Host: GitHub
- URL: https://github.com/arthur87/asa_json
- Owner: arthur87
- License: mit
- Created: 2025-03-12T12:41:07.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-18T13:29:35.000Z (about 1 year ago)
- Last Synced: 2025-11-29T22:29:53.495Z (4 months ago)
- Topics: csv, gem, json, jsonl, ruby
- Language: Ruby
- Homepage: https://www.daispot.com
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.base.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# asa_json
[](https://badge.fury.io/rb/asa_json)
asa_json is a library for conveniently JSON.
It supports reading and writing json and jsonl files.
# Usage
See spec files.
## Read JSONL
```
pp AsaJson.read_jsonl("#{__dir__}/test.jsonl")
```
The output result is here.
```
[{"id"=>1, "name"=>"cerulean", "year"=>2000, "color"=>"#98B2D1", "pantone_value"=>"15-4020"},
{"id"=>2, "name"=>"fuchsia rose", "year"=>2001, "color"=>"#C74375", "pantone_value"=>"17-2031"},
{"id"=>3, "name"=>"true red", "year"=>2002, "color"=>"#BF1932", "pantone_value"=>"19-1664"}]
```
## Write JSONL
```
test = [
{ 'id' => 1, 'name' => 'cerulean', 'year' => 2000, 'color' => '#98B2D1', 'pantone_value' => '15-4020' },
{ 'id' => 2, 'name' => 'fuchsia rose', 'year' => 2001, 'color' => '#C74375',
'pantone_value' => '17-2031' },
{ 'id' => 3, 'name' => 'true red', 'year' => 2002, 'color' => '#BF1932', 'pantone_value' => '19-1664' }
]
AsaJson.write_jsonl("#{__dir__}/output.jsonl", test)
```
json uses read_json and write_json.