Debian Codegraph @

README.md

raw symbols SCIP
1 ![gojsonq-logo](gojsonq.png)
2
3 [![Build Status](https://travis-ci.org/thedevsaddam/gojsonq.svg?branch=master)](https://travis-ci.org/thedevsaddam/gojsonq)
4 [![Project status](https://img.shields.io/badge/version-v2-green.svg)](https://github.com/thedevsaddam/gojsonq/releases)
5 [![Go Report Card](https://goreportcard.com/badge/github.com/thedevsaddam/gojsonq)](https://goreportcard.com/report/github.com/thedevsaddam/gojsonq)
6 [![Coverage Status](https://coveralls.io/repos/github/thedevsaddam/gojsonq/badge.svg?branch=master)](https://coveralls.io/github/thedevsaddam/gojsonq)
7 [![GoDoc](https://godoc.org/github.com/thedevsaddam/gojsonq?status.svg)](https://pkg.go.dev/github.com/thedevsaddam/gojsonq/v2)
8 [![License](https://img.shields.io/dub/l/vibe-d.svg)](LICENSE.md)
9
10 A simple Go package to Query over JSON Data. It provides [simple](https://github.com/thedevsaddam/gojsonq/wiki/Queries#jsonstringjson), [elegant](https://github.com/thedevsaddam/gojsonq/wiki/Queries#selectproperties) and [fast](https://github.com/thedevsaddam/gojsonq/wiki/Benchmark) [ODM](https://github.com/thedevsaddam/gojsonq/wiki/Queries#frompath) like API to access, query JSON document
11
12 ### Installation
13
14 Install the package using
15 ```go
16 $ go get github.com/thedevsaddam/gojsonq/v2
17 ```
18
19 ### Usage
20
21 To use the package import it in your `*.go` code
22 ```go
23 import "github.com/thedevsaddam/gojsonq/v2"
24 ```
25
26 Let's see a quick example:
27
28 [See in playground](https://play.golang.org/p/UiqyllP2vkn)
29
30 ```go
31 package main
32
33 import gojsonq "github.com/thedevsaddam/gojsonq/v2"
34
35 func main() {
36 const json = `{"name":{"first":"Tom","last":"Hanks"},"age":61}`
37 name := gojsonq.New().FromString(json).Find("name.first")
38 println(name.(string)) // Tom
39 }
40 ```
41
42 Another example:
43
44 [See in playground](https://play.golang.org/p/QLVxpi6nVbi)
45
46 ```go
47 package main
48
49 import (
50 "fmt"
51
52 gojsonq "github.com/thedevsaddam/gojsonq/v2"
53 )
54
55 func main() {
56 const json = `{"city":"dhaka","type":"weekly","temperatures":[30,39.9,35.4,33.5,31.6,33.2,30.7]}`
57 avg := gojsonq.New().FromString(json).From("temperatures").Avg()
58 fmt.Printf("Average temperature: %.2f", avg) // 33.471428571428575
59 }
60 ```
61
62 You can query your document using the various query methods such as **[Find](https://github.com/thedevsaddam/gojsonq/wiki/Queries#findpath)**, **[First](https://github.com/thedevsaddam/gojsonq/wiki/Queries#first)**, **[Nth](https://github.com/thedevsaddam/gojsonq/wiki/Queries#nthindex)**, **[Pluck](https://github.com/thedevsaddam/gojsonq/wiki/Queries#pluckproperty)**, **[Where](https://github.com/thedevsaddam/gojsonq/wiki/Queries#wherekey-op-val)**, **[OrWhere](https://github.com/thedevsaddam/gojsonq/wiki/Queries#orwherekey-op-val)**, **[WhereIn](https://github.com/thedevsaddam/gojsonq/wiki/Queries#whereinkey-val)**, **[WhereStartsWith](https://github.com/thedevsaddam/gojsonq/wiki/Queries#wherestartswithkey-val)**, **[WhereEndsWith](https://github.com/thedevsaddam/gojsonq/wiki/Queries#whereendswithkey-val)**, **[WhereContains](https://github.com/thedevsaddam/gojsonq/wiki/Queries#wherecontainskey-val)**, **[Sort](https://github.com/thedevsaddam/gojsonq/wiki/Queries#sortorder)**, **[GroupBy](https://github.com/thedevsaddam/gojsonq/wiki/Queries#groupbyproperty)**, **[SortBy](https://github.com/thedevsaddam/gojsonq/wiki/Queries#sortbyproperty-order)** and so on. Also you can aggregate data after query using **[Avg](https://github.com/thedevsaddam/gojsonq/wiki/Queries#avgproperty)**, **[Count](https://github.com/thedevsaddam/gojsonq/wiki/Queries#count)**, **[Max](https://github.com/thedevsaddam/gojsonq/wiki/Queries#maxproperty)**, **[Min](https://github.com/thedevsaddam/gojsonq/wiki/Queries#minproperty)**, **[Sum](https://github.com/thedevsaddam/gojsonq/wiki/Queries#sumproperty)** etc.
63
64 ## Find more query API in [Wiki page](https://github.com/thedevsaddam/gojsonq/wiki/Queries)
65
66 ## Bugs and Issues
67
68 If you encounter any bugs or issues, feel free to [open an issue at
69 github](https://github.com/thedevsaddam/gojsonq/issues).
70
71 Also, you can shoot me an email to
72 <mailto:[email protected]> for hugs or bugs.
73
74 ## Credit
75
76 Special thanks to [Nahid Bin Azhar](https://github.com/nahid) for the inspiration and guidance for the package. Thanks to [Ahmed Shamim Hasan Shaon](https://github.com/me-shaon) for his support from the very beginning.
77
78 ## Contributors
79 * [Lenin Hasda](https://github.com/leninhasda)
80 * [Sadlil Rhythom](https://github.com/sadlil)
81 * [See contributors list here](https://github.com/thedevsaddam/gojsonq/graphs/contributors)
82
83 ## Contribution
84 If you are interested to make the package better please send pull requests or create an issue so that others can fix.
85 [Read the contribution guide here](CONTRIBUTING.md)
86
87 ## Special Thanks
88 <a href="https://www.jetbrains.com/?from=gojsonq"><img src="jetbrains-grayscale.png" height="100" width="100" ></a>
89
90 ## License
91 The **gojsonq** is an open-source software licensed under the [MIT License](LICENSE.md).