快速获取 JSON 文档 gjson

码农软件 · 软件分类 · JSON/BSON开发包 · 2019-03-30 21:27:19

软件介绍

gjson 是一个 Go 开发包,提供了非常快速和简单的方式来获得一个 JSON 文档的值。此文库的存在是为 BuntDB 项目提供高效的 JSON 索引。

安装:

开始使用 GJSON,安装 Go ,并运行go get:

$ go get -u github.com/tidwall/gjson

此操作可恢复文库。

性能:

 encoding/jsonffjsonEasyJSON, 和 jsonparser 并列的 GJSON 基准点。

BenchmarkGJSONGet-8                 15000000           333 ns/op           0 B/op          0 allocs/op
BenchmarkGJSONUnmarshalMap-8          900000          4188 ns/op        1920 B/op         26 allocs/op
BenchmarkJSONUnmarshalMap-8           600000          8908 ns/op        3048 B/op         69 allocs/op
BenchmarkJSONUnmarshalStruct-8        600000          9026 ns/op        1832 B/op         69 allocs/op
BenchmarkJSONDecoder-8                300000         14339 ns/op        4224 B/op        184 allocs/op
BenchmarkFFJSONLexer-8               1500000          3156 ns/op         896 B/op          8 allocs/op
BenchmarkEasyJSONLexer-8             3000000           938 ns/op         613 B/op          6 allocs/op
BenchmarkJSONParserGet-8             3000000           442 ns/op          21 B/op          0 allocs/op

JSON 文档使用:

{  "widget": {    "debug": "on",    "window": {      "title": "Sample Konfabulator Widget",      "name": "main_window",      "width": 500,      "height": 500
    },    "image": { 
      "src": "Images/Sun.png",      "hOffset": 250,      "vOffset": 250,      "alignment": "center"
    },    "text": {      "data": "Click Here",      "size": 36,      "": "bold",      "vOffset": 100,      "alignment": "center",      "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
    }
  }
}

每个操作都是通过下面的搜索路径之一回转:

widget.window.name
widget.image.hOffset
widget.text.onMouseU

本文地址:https://www.codercto.com/soft/d/2513.html

Building Social Web Applications

Building Social Web Applications

Gavin Bell / O'Reilly Media / 2009-10-1 / USD 34.99

Building a social web application that attracts and retains regular visitors, and gets them to interact, isn't easy to do. This book walks you through the tough questions you'll face if you're to crea......一起来看看 《Building Social Web Applications》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具