bradford-hamilton / dora

Licence: MIT license
JSON parser/explorer

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to dora

Whois
Go(Golang) module for domain and ip whois information query.
Stars: ✭ 153 (+264.29%)
Mutual labels:  query
Awesome Prometheus Alerts
🚨 Collection of Prometheus alerting rules
Stars: ✭ 3,323 (+7811.9%)
Mutual labels:  query
wikit
Wikit - A universal lookup tool
Stars: ✭ 149 (+254.76%)
Mutual labels:  query
Sqldb Logger
A logger for Go SQL database driver without modify existing *sql.DB stdlib usage.
Stars: ✭ 160 (+280.95%)
Mutual labels:  query
Rrda
REST API allowing to perform DNS queries over HTTP
Stars: ✭ 176 (+319.05%)
Mutual labels:  query
Bigbash
A converter that generates a bash one-liner from an SQL Select query (no DB necessary)
Stars: ✭ 230 (+447.62%)
Mutual labels:  query
Use Http
🐶 React hook for making isomorphic http requests
Stars: ✭ 2,066 (+4819.05%)
Mutual labels:  query
fetchye
✨ If you know how to use Fetch, you know how to use Fetchye [fetch-yae]. Simple React Hooks, Centralized Cache, Infinitely Extensible.
Stars: ✭ 36 (-14.29%)
Mutual labels:  query
Search widget
Flutter package: Search Widget for selecting an option from a data list.
Stars: ✭ 188 (+347.62%)
Mutual labels:  query
Aresdb
A GPU-powered real-time analytics storage and query engine.
Stars: ✭ 2,814 (+6600%)
Mutual labels:  query
Query Translator
Query Translator is a search query translator with AST representation
Stars: ✭ 165 (+292.86%)
Mutual labels:  query
Minestat
📈 A Minecraft server status checker
Stars: ✭ 168 (+300%)
Mutual labels:  query
Termsql
Convert text from a file or from stdin into SQL table and query it instantly. Uses sqlite as backend. The idea is to make SQL into a tool on the command line or in scripts.
Stars: ✭ 230 (+447.62%)
Mutual labels:  query
Fselect
Find files with SQL-like queries
Stars: ✭ 3,103 (+7288.1%)
Mutual labels:  query
strapi-graphql-documentation
Collections of queries and mutations that hopefully help you in a Strapi project powered by GraphQL API 🚀
Stars: ✭ 45 (+7.14%)
Mutual labels:  query
Laravel Api Handler
Package providing helper functions for a Laravel REST-API
Stars: ✭ 150 (+257.14%)
Mutual labels:  query
Octosql
OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.
Stars: ✭ 2,579 (+6040.48%)
Mutual labels:  query
juice
Reduce in memory data structures using a lightweight query language
Stars: ✭ 24 (-42.86%)
Mutual labels:  query
kubectl-sql
kubectl-sql is a kubectl plugin that use SQL like language to query the Kubernetes cluster manager
Stars: ✭ 50 (+19.05%)
Mutual labels:  query
Sqliterally
Lightweight SQL query builder
Stars: ✭ 231 (+450%)
Mutual labels:  query
Dora backpack with JSON

Welcome to dora the JSON explorer 👋

Using go version 1.14 Using go version 1.14 Go Report Card godoc License: MIT

Dora makes exploring JSON fast, painless, and elegant.

NOTE:

  • dora's main focus was for teaching the content through a medium blog post. In other words, dora is not currently a stable tool.

Install

go get github.com/bradford-hamilton/dora/pkg/dora

Usage

var exampleJSON = `{ "string": "a neat string", "bool": true, "PI": 3.14159 }`

c, err := dora.NewFromString(exampleJSON)
if err != nil {
  return err
}

str, err := c.GetString("$.string")
if err != nil {
  return err
}

boolean, err := c.GetBool("$.bool")
if err != nil {
  return err
}

float, err := c.GetFloat64("$.PI")
if err != nil {
  return err
}

fmt.Println(str)     // a neat string
fmt.Println(boolean) // true
fmt.Println(float)   // 3.14159

Query Syntax

  1. All queries start with $.

  2. Access objects with . only, no support for object access with bracket notation [].

    • This is intentional, as you can interpolate at the call site, so there is no reason to offer two syntaxes that do the same thing.
  3. Access arrays by index with bracket notation [].

  4. New: Fetch by type to allow caller to ask for the proper Go type. For the time being, asking for objects or arrays in their entirety must be done through GetString which will return the chunk of JSON.

    Current API:

    • GetString
    • GetFloat64
    • GetBool
  5. Next feature will be approaching this either with some sort of serialization option maybe similar to stdlib or a simpler one with no options that returns a map or something? Will think about that some.

Example with a JSON object as root value:

JSON:

{
  "name": "bradford",
  "someArray": ["some", "values"]
  "obj": {
    "innerKey": {
      "innerKey2": "innerValue",
      "innerKey3": [{ "kindOfStuff": "neatStuff" }]
    }
  },
  "someBool": true,
  "PI": 3.14159
}

Query:                                  Result:

$.name                                  == "bradford"
$.someArray                             == "[\"array\", \"values\"]"
$.someArray[0]                          == "some"
$.someArray[1]                          == "values"
$.someArray[2]                          == error
$.obj.innerKey.innerKey2                == "innerValue"
$.obj.innerKey.innerKey3[0].kindOfStuff == "neatStuff"
$.someBool                              == true
$.PI                                    == 3.14159

Example with a JSON array as root value:

JSON:

[
  "some",
  "values",
  {
    "objKey": "objValue",
    "objKey2": [{ "catstack": "lampcat" }]
  }
]

Query:                   Result:

$[0]                     == "some"
$[1]                     == "values"
$[2]                     == "{ \"objKey\": \"objValue\", \"objKey2\": [{ \"catstack\": \"lampcat\" }] }"
$[2].objKey              == "objValue"
$[2].objKey2[0]          == "{ \"catstack\": \"lampcat\" }"
$[2].objKey2[0].catstack == "lampcat"

Run tests

go test ./...

Author

👤 Bradford Lamson-Scribner

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].