Skip to content

Commit 65ea093

Browse files
committed
docs: write the README and the CONTRIBUTING files
1 parent f307a21 commit 65ea093

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Contributing to jsonpointer-go
2+
3+
Thank you for considering to contribute to `jsonpointer-go`! Below are some guidelines to help you get started.
4+
5+
## How to Contribute
6+
7+
1. Fork the repository
8+
2. Create a new branch (`git checkout -b feature-branch`)
9+
3. Commit your changes (`git commit -am 'Add new feature'`)
10+
4. Push to the branch (`git push origin feature-branch`)
11+
5. Create a new Pull Request
12+
13+
## Reporting Issues
14+
15+
If you find any bugs or have feature requests, please create an issue on the [GitHub Issues](https://github.com/BragdonD/jsonpointer-go/issues) page.
16+
17+
---
18+
19+
Thank you for your contributions!

README.md

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,75 @@
1-
# JavaScript Object Notation (JSON) Pointer in Golang
1+
# jsonpointer-go
22

3+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4+
5+
An implementation of RFC 6901 - JavaScript Object Notation (JSON) Pointer in Golang.
6+
7+
## Table of Contents
8+
9+
- [Table of Contents](#table-of-contents)
10+
- [Introduction](#introduction)
11+
- [Installation](#installation)
12+
- [Usage](#usage)
13+
- [Contributing](#contributing)
14+
- [License](#license)
15+
16+
## Introduction
17+
18+
`jsonpointer-go` is a Go library for working with JSON Pointers as defined in [RFC 6901](https://tools.ietf.org/html/rfc6901). JSON Pointers provide a way to reference specific parts of a JSON document.
19+
20+
## Installation
21+
22+
To install the library, simply run:
23+
24+
```sh
25+
go get github.com/bragdond/jsonpointer-go
26+
```
27+
28+
## Usage
29+
30+
Here is a simple example of how to use `jsonpointer-go`:
31+
32+
```go
33+
package main
34+
35+
import (
36+
"fmt"
37+
"github.com/bragdond/jsonpointer-go"
38+
)
39+
40+
func main() {
41+
jsonStr := `{
42+
"foo": ["bar", "baz"],
43+
"qux": {"corge": "grault"}
44+
}`
45+
46+
var jsonData map[string]any
47+
if err := json.Unmarshal([]byte(jsonStr), &jsonData); err != nil {
48+
panic(fmt.Sprintf("failed to unmarshal json string: %v", err))
49+
}
50+
51+
pointer, err := jsonpointer.Parse("/foo/0")
52+
if err != nil {
53+
panic(err)
54+
}
55+
56+
result, err := pointer.GetValue(jsonData)
57+
if err != nil {
58+
panic(err)
59+
}
60+
61+
fmt.Println(result) // Output: bar
62+
}
63+
```
64+
65+
## Contributing
66+
67+
We welcome contributions! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on how to contribute.
68+
69+
## License
70+
71+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
72+
73+
---
74+
75+
Happy coding!

0 commit comments

Comments
 (0)