gjson
15,563
Stars
1,378
Forks
157
Watchers
12
Open Issues
MIT
许可证
Go
语言
2016-08-11
创建时间
2026-11-08
最近更新
项目能做什么
专为 Go 语言打造的高性能 JSON 解析库,可极速提取指定字段值。
来源:AI 基于仓库事实生成
· 内容以仓库实际 README 为准
使用说明 查看原始 README 原仓库文档
中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset=".github/images/logo-dark.png">
<source media="(prefers-color-scheme: light)" srcset=".github/images/logo-light.png">
<img src=".github/images/logo-light.png" width="240" alt="GJSON" >
</picture>
<br>
<a href="https://godoc.org/github.com/tidwall/gjson"><img src="https://img.shields.io/badge/api-reference-blue.svg?style=flat-square" alt="GoDoc"></a>
<a href="https://tidwall.com/gjson-play"><img src="https://img.shields.io/badge/%F0%9F%8F%90-playground-9900cc.svg?style=flat-square" alt="GJSON Playground"></a>
<a href="SYNTAX.md"><img src="https://img.shields.io/badge/{}-syntax-33aa33.svg?style=flat-square" alt="GJSON Syntax"></a>
</p>
<p align="center">get json values quickly</a></p>
GJSON is a Go package that provides a [fast](#performance) and [simple](#get-a-value) way to get values from a json document.
It has features such as [one line retrieval](#get-a-value), [dot notation paths](#path-syntax), [iteration](#iterate-through-an-object-or-array), and [parsing json lines](#json-lines).
Also check out [SJSON](https://github.com/tidwall/sjson) for modifying json, and the [JJ](https://github.com/tidwall/jj) command line tool.
This README is a quick overview of how to use GJSON, for more information check out [GJSON Syntax](SYNTAX.md).
GJSON is also available for [Python](https://github.com/volans-/gjson-py) and [Rust](https://github.com/tidwall/gjson.rs)
Getting Started
===============
## Installing
To start using GJSON, install Go and run `go get`:
```sh
$ go get -u github.com/tidwall/gjson
```
This will retrieve the library.
## Get a value
Get searches json for the specified path. A path is in dot syntax, such as "name.last" or "age". When the value is found it's returned immediately.
```go
package main
import "github.com/tidwall/gjson"
const json = `{"name":{"first":"Janet","last":"Prichard"},"age":47}`
func main() {
value := gjson.Get(json, "name.last")
println(value.String())
}
```
This will print:
```
Prichard
```
*There's also [GetBytes](#working-with-bytes) for working with JSON byte slices.*
## Path Syntax
Below is a quick overview of the path syntax, for more complete information please
check out [GJSON Syntax](SYNTAX.md).
A path is a series of keys separated by a dot.
A key may contain special wildcard characters '\*' and '?'.
To access an array value use the index as the key.
To get the number of elements in an array or to access a child path, use the '#' character.
The dot and wildcard characters can be escaped with '\\'.
```json
{
"name": {"first": "Tom", "last": "Anderson"},
"age":37,
"children": ["Sara","Alex","Jack"],
"fav.movie": "Deer Hunter",
"friends": [
{"first": "Dale", "last": "Murphy", "age": 44, "nets": ["ig", "fb", "tw"]},
{"first": "Roger", "last": "Craig", "age": 68, "nets": ["fb", "tw"]},
{"first": "Jane", "last": "Murphy", "age": 47, "nets": ["ig", "tw"]}
]
}
```
```
"name.last"
阅读完整原文
项目深度分析 AI 生成
基于 GJSON 语法的轻量级高性能 API 网关与请求路由服务
| 产品构想 | 利用 GJSON 的单行极速解析和 dot-notation 语法,打造超低内存占用的 JSON 过滤与动态路由网关(类似轻量 Kong 或 Envoy 扩展)。 |
| 核心功能 | 基于 GJSON 语法的路由分发、实时字段提取与重写、无反射零内存拷贝转发、可视化路由配置面板。 |
| 目标用户 | 中小型开发团队、微服务架构师、需要处理海量 Webhook/日志清洗的运维开发人员。 |
| 难度/周期 | 中等 · 1 - 2 个月 · 成本:低(基础云服务器及网络带宽成本)。 |
| 收费模式 | 核心开源,高级管理后台、多节点集群管控及指标监控功能采用订阅制 SaaS 或商业许可。 |
| 竞争风险 | 面对现有成熟网关(如 Traefik、APISIX)的生态竞争,需专注在极端轻量和 JSON 深度过滤细分场景。 |
| 依据 | 已验证事实 |
开发者桌面/Web 端 JSON 探索与高性能抽取调试工具
| 产品构想 | 开发一个基于 WebAssembly/本地运行的高性能 JSON 结构分析与 GJSON 表达式调试器,替代现有低效的在线 JSON 格式化工具。 |
| 核心功能 | GB 级大文件秒开与虚拟滚动、GJSON 路径实时语法高亮与自动补全、提取结果批量导出为 CSV/Parquet。 |
| 目标用户 | 日常处理 GB 级超大 JSON、复杂嵌套结构日志的后端开发、数据分析师与测试工程师。 |
| 难度/周期 | 低 · 2 - 4 周 · 成本:极低(主要是域名与前端静态托管)。 |
| 收费模式 | 桌面端(Electron/Tauri)采用买断制收费(如 $19/人),大文件处理及团队协同作为付费功能。 |
| 竞争风险 | 受众对开发工具付费意愿参差不齐,竞品(如 jq 类工具)多为免费工具。 |
| 依据 | 数据支持的判断 |
高吞吐量 JSON 日志/事件流实时过滤与报警代理(Sidecar)
| 产品构想 | 针对 Vector/Logstash 资源消耗过大的痛点,基于 GJSON 构建内存极低的日志流过滤与富化代理程序。 |
| 核心功能 | 极低 CPU/内存占用率、基于 GJSON 语法的事件匹配报警、敏感数据脱敏、下游动态分发。 |
| 目标用户 | 云原生 DevOps 工程师、SRE、边缘计算运维人员。 |
| 难度/周期 | 中等 · 2 - 3 个月 · 成本:低(主要为测试多环境基准测试资源)。 |
| 收费模式 | 开源单机版,企业级提供集中式策略下发控制器(SaaS/私有部署)及技术支持服务。 |
| 竞争风险 | 开源日志收集系统生态成熟(Vector、Fluentbit),需要明确打出超低资源消耗的差异化标签。 |
| 依据 | AI推测 |
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心
竞品与相似项目 GitHub Search 真实检索
| 项目 | 中文简介 | Stars | 语言 |
|---|---|---|---|
| tidwall/gjson.rs | 中文介绍暂未生成 Get JSON values quickly - JSON parser for Rust |
250 | Rust |
| cloudwego/gjson | 中文介绍暂未生成 Faster substitution of tidwall/gjson |
57 | Go |
| volans-/gjson-py | 中文介绍暂未生成 A Python package that provides a simple way to filter and ex |
45 | Python |
| fiatjaf/lightningd-gjson-rpc | 中文介绍暂未生成 Talk with a lightningd/c-lightning with minimal overhead and |
44 | Go |
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。
项目优势与风险
| 技术成熟度 | 创建于 2016-08-11,近 30 天仍在推送 |
| 社区活跃 | Star 15,563 / Fork 1,378 / Issue 12(数据支持,可自行核实) |
| 许可证 | MIT |
| 主要风险 | 上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价 |
安装与使用
此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。