init: Initial commit

This commit is contained in:
Björn Benouarets
2026-01-22 12:14:49 +01:00
commit 9072d798c8
3 changed files with 163 additions and 0 deletions

60
README.md Normal file
View File

@@ -0,0 +1,60 @@
# Go JSON Mapper (gojsonmapper)
This is a simple library that allows you to map different JSON objects to each other.
## Example
This example shows how to map a JSON object to another JSON object.
### Mapping
```json
{
"name": "data.name",
"address": "data.addresses[0]"
}
````
### Input JSON
```json
{
"data": {
"name": "John Doe",
"addresses": [
"123 Main St"
]
}
}
```
### Output JSON
```json
{
"name": "John Doe",
"address": "123 Main St"
}
```
## Usage
### Read Mapping
```go
mapping, err := ReadMapping("mapping.json")
if err != nil {
log.Fatal(err)
}
```
### Map Input
```go
mapper := NewMapper(mapping)
output, err := mapper.Map(input)
if err != nil {
log.Fatal(err)
}
fmt.Println(output)
```