Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shahincsejnu/json-avro-converter
This project is to convert from `JSON to Avro` format and `Avro to JSON`, it also support OCF file Read/Write.
https://github.com/shahincsejnu/json-avro-converter
avro converter golang json ocf
Last synced: about 4 hours ago
JSON representation
This project is to convert from `JSON to Avro` format and `Avro to JSON`, it also support OCF file Read/Write.
- Host: GitHub
- URL: https://github.com/shahincsejnu/json-avro-converter
- Owner: shahincsejnu
- License: apache-2.0
- Created: 2022-09-14T18:20:20.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-09T15:23:15.000Z (over 1 year ago)
- Last Synced: 2024-06-20T16:49:19.319Z (5 months ago)
- Topics: avro, converter, golang, json, ocf
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# json-avro-converter
This project is to convert from `JSON to Avro` format and `Avro to JSON`, it also support OCF file Read/Write.## How to use this package in your code?
- import this package `"github.com/shahincsejnu/json-avro-converter/converters"` in your Go code, like:
```
import (
"github.com/shahincsejnu/json-avro-converter/converters"
)
```
- use respective functions in your code, like:
```
converters.JsonToAvro()
converters.AvroToJson()
converters.OcfFileWrite()
converters.OcfFileWrite()
```
> provide related parameters of these functions too!## Examples
- Check the [examples](./examples/) folder to see demo use of this project
- To run the examples go to the respective example folder and run `go run main.go`## Features
- [x] conversion from JSON to Avro format
- [x] conversion from Avro to JSON
- [x] OCF file read
- [x] OCF file Write
- [ ] adding CLI for these conversion
- [ ] adding validator for validating the formats## JSON & Avro format's example
### JSON format
```json
{
"name": "shahin",
"age": 20,
"roll": "oka",
"others": [
{
"name": "okaoka"
}
]
}
```### Avro
```
{
"name": "MyClass",
"type": "record",
"namespace": "com.acme.avro",
"fields": [
{
"name": "name",
"type": "string"
},
{
"name": "age",
"type": "int"
},
{
"name": "roll",
"type": "string"
},
{
"name": "others",
"type": {
"type": "array",
"items": {
"name": "others_record",
"type": "record",
"fields": [
{
"name": "name",
"type": "string"
}
]
}
}
}
]
}
```## References
- [goavro example](https://github.com/linkedin/goavro/blob/master/examples/165/main.go)
- [goavro package](https://pkg.go.dev/github.com/linkedin/goavro/v2#section-readme)