• Stars
    star
    2,176
  • Rank 21,195 (Top 0.5 %)
  • Language
    Go
  • License
    MIT License
  • Created over 6 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple Go package to Query over JSON/YAML/XML/CSV Data

gojsonq-logo

Build Status Project status Go Report Card Coverage Status GoDoc License

A simple Go package to Query over JSON Data. It provides simple, elegant and fast ODM like API to access, query JSON document

Installation

Install the package using

$ go get github.com/thedevsaddam/gojsonq/v2

Usage

To use the package import it in your *.go code

import "github.com/thedevsaddam/gojsonq/v2"

Let's see a quick example:

See in playground

package main

import gojsonq "github.com/thedevsaddam/gojsonq/v2"

func main() {
	const json = `{"name":{"first":"Tom","last":"Hanks"},"age":61}`
	name := gojsonq.New().FromString(json).Find("name.first")
	println(name.(string)) // Tom
}

Another example:

See in playground

package main

import (
	"fmt"

	gojsonq "github.com/thedevsaddam/gojsonq/v2"
)

func main() {
	const json = `{"city":"dhaka","type":"weekly","temperatures":[30,39.9,35.4,33.5,31.6,33.2,30.7]}`
	avg := gojsonq.New().FromString(json).From("temperatures").Avg()
	fmt.Printf("Average temperature: %.2f", avg) // 33.471428571428575
}

You can query your document using the various query methods such as Find, First, Nth, Pluck, Where, OrWhere, WhereIn, WhereStartsWith, WhereEndsWith, WhereContains, Sort, GroupBy, SortBy and so on. Also you can aggregate data after query using Avg, Count, Max, Min, Sum etc.

Find more query API in Wiki page

Bugs and Issues

If you encounter any bugs or issues, feel free to open an issue at github.

Also, you can shoot me an email to mailto:[email protected] for hugs or bugs.

Credit

Special thanks to Nahid Bin Azhar for the inspiration and guidance for the package. Thanks to Ahmed Shamim Hasan Shaon for his support from the very beginning.

Contributors

Contribution

If you are interested to make the package better please send pull requests or create an issue so that others can fix. Read the contribution guide here

License

The gojsonq is an open-source software licensed under the MIT License.

More Repositories

1

govalidator

Validate Golang request data with simple rules. Highly inspired by Laravel's request validation.
Go
1,311
star
2

docgen

Transform your postman collection to HTML/Markdown documentation
Go
963
star
3

renderer

Simple, lightweight and faster response (JSON, JSONP, XML, YAML, HTML, File) rendering package for Go
Go
261
star
4

laravel-schema

Display the connected database information from Terminal.
PHP
112
star
5

task

Terminal tasks todo with reminder tool for geek
Go
81
star
6

retry

Simple and easy retry mechanism package for Go
Go
66
star
7

dl

Command-line file downloader tool
Go
50
star
8

ubuntu-live-wallpaper

Live wallpaper changer for ubuntu. Inspired from chrome momentum extension
Python
44
star
9

lumen-route-list

Display all the registered route list in lumen application just like laravel.
PHP
36
star
10

orchid-micro

Golang boilerplate using gin-gonic framework and gorm for microservice
Go
30
star
11

todoapp

Tutorial purpose repository
Go
27
star
12

docgen-bin

Transform your postman collection to html documentation
26
star
13

slack-notifier

This script will help you to send slack scheduled notification (message)
Python
22
star
14

world-countries

Provide world country list with country code, city, states and flag
PHP
19
star
15

gomailer

Gomailer provides a simple email interface to integrate third party email services.
Go
14
star
16

bongo

Terminal based bengali calendar
Go
14
star
17

ponjika

Tiny bengali ponjika based on Gregorian date
Go
12
star
18

traffic

Thread safe load-balancer package for Golang
Go
11
star
19

orchid

A MVC style boilerplate for golang
Go
11
star
20

snapshot

Robust, Persistent, Key-Value (KV) store purely written in Golang
Go
11
star
21

radar

Package radar help to debug nested function call and Trace current file/line
Go
9
star
22

unpack

Go assignment by slice, array unpacking or destructuring
Go
9
star
23

q

[WIP] "q" a command-line tool to query JSON/XML/YAML/CSV document
Go
8
star
24

iter

Iter provides functionality like Python's range function to iterate over numbers and letters
Go
8
star
25

querybuilder

A fake query builder to demonstrate the factory and singleton pattern
Go
7
star
26

multiple_route

MultipleRoute generator is helpful create any number of routes for your large laravel project.
PHP
6
star
27

clean

[WIP] Trying to make a boilerplate for clean-architecture in Golang
Go
5
star
28

task_binaries

Task binary files
5
star
29

timezones

PHP supported timezones array
PHP
4
star
30

dictionary

Offline terminal dictionary
Go
3
star
31

dj1.9

learning django 1.9 with python 3
Python
3
star
32

vue1-learning

Playing with vue.js v1.0
HTML
3
star
33

thedevsaddam

Portfolio Page
3
star
34

enToBnDigit

English digit to bengali digit...
PHP
3
star
35

py-ghataghati

Just trying to figure out python
Python
3
star
36

py-app

Learning django
Python
3
star
37

thedevsaddam.github.io

Personal blog site
CSS
3
star
38

go-repl

GO REPL is a simple application promising to write/compile/run code in terminal, inspired by python shell
Go
3
star
39

pc-ready

Its a shell script that will setup essential software and development environment for your Ubuntu OS
Shell
3
star
40

vue-simple-todo

Simple vue todo
HTML
3
star
41

go-ladder

Database migration package for golang inspired by Laravel migration
3
star
42

dj-project

Learning django...
Python
3
star
43

erlang

Playing with Erlang
Erlang
2
star
44

files

Contains files for public repositories
2
star
45

homebrew-cli

Contains formula for different tools for mac
Ruby
2
star
46

es6

ECMAScript 6, also known as ECMAScript 2015
JavaScript
2
star
47

worker

Go
2
star
48

go_repl_binaries

GO REPL is a simple application promising to write/compile/run code in terminal, inspired by python shell
2
star
49

ubuntu-500px-wallpaper

Inspired from chrome momentum extension. Get new wallpaper from 500px popular section, each time restart the computer.
Shell
2
star
50

30-seconds-of-go

2
star
51

reactjs

Learning react js
JavaScript
2
star
52

tweet-release

Go
1
star
53

action

GitHub action to supercharge your pull requests workflows!
Go
1
star
54

assessment-200

Python
1
star
55

lo_

A modern Rust utility library delivering modularity, performance & extras proted from JavaScript Lodash
Rust
1
star