{"id":13413273,"url":"https://github.com/Andrew-M-C/go.jsonvalue","last_synced_at":"2025-03-14T19:31:47.069Z","repository":{"id":40498330,"uuid":"212598269","full_name":"Andrew-M-C/go.jsonvalue","owner":"Andrew-M-C","description":"Quick Solution with Unstructured JSON data","archived":false,"fork":false,"pushed_at":"2024-08-21T02:50:24.000Z","size":566,"stargazers_count":183,"open_issues_count":0,"forks_count":19,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-21T03:25:49.869Z","etag":null,"topics":["go","golang","json"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Andrew-M-C.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-03T14:16:41.000Z","updated_at":"2024-08-09T07:22:53.000Z","dependencies_parsed_at":"2024-06-17T03:25:01.341Z","dependency_job_id":"c98ec469-c3c4-49b8-8d62-532ea9d9cdb7","html_url":"https://github.com/Andrew-M-C/go.jsonvalue","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andrew-M-C%2Fgo.jsonvalue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andrew-M-C%2Fgo.jsonvalue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andrew-M-C%2Fgo.jsonvalue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andrew-M-C%2Fgo.jsonvalue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Andrew-M-C","download_url":"https://codeload.github.com/Andrew-M-C/go.jsonvalue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243635327,"owners_count":20322921,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","json"],"created_at":"2024-07-30T20:01:36.605Z","updated_at":"2025-03-14T19:31:46.739Z","avatar_url":"https://github.com/Andrew-M-C.png","language":"Go","funding_links":[],"categories":["JSON","Go"],"sub_categories":["Search and Analytic Databases","检索及分析资料库"],"readme":"# Jsonvalue - A Fast and Convenient Alternation of Go map[string]interface{}\n\n[![Workflow](https://github.com/Andrew-M-C/go.jsonvalue/actions/workflows/go_test_general.yml/badge.svg)](https://github.com/Andrew-M-C/go.jsonvalue/actions/workflows/go_test_general.yml)\n[![codecov](https://codecov.io/gh/Andrew-M-C/go.jsonvalue/branch/dev/github_workflow/graph/badge.svg?token=REDI4YDLPR\u0026date=221104)](https://codecov.io/gh/Andrew-M-C/go.jsonvalue)\n[![Go report](https://goreportcard.com/badge/github.com/Andrew-M-C/go.jsonvalue?date=221104)](https://goreportcard.com/report/github.com/Andrew-M-C/go.jsonvalue)\n[![CodeBeat](https://codebeat.co/badges/ecf87760-2987-48a7-a6dd-4d9fcad57256)](https://codebeat.co/projects/github-com-andrew-m-c-go-jsonvalue-master)\n\n[![GoDoc](https://godoc.org/github.com/Andrew-M-C/go.jsonvalue?status.svg\u0026date=221104)](https://pkg.go.dev/github.com/Andrew-M-C/go.jsonvalue@v1.4.0)\n[![Latest](https://img.shields.io/badge/latest-v1.4.0-blue.svg?date=221104)](https://github.com/Andrew-M-C/go.jsonvalue/tree/v1.4.0)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?date=221104)](https://opensource.org/license/MIT)\n\n- [Wiki](./docs/en/README.md)\n- [中文版](./docs/zh-cn/README.md)\n\nPackage **jsonvalue** is for handling unstructured JSON data or customizing JSON marshaling. It is far more faster and convenient than using `interface{}` with `encoding/json`.\n\nPlease refer to [pkg site](https://pkg.go.dev/github.com/Andrew-M-C/go.jsonvalue) or [wiki](./docs/en/README.md) for detailed usage and examples.\n\nEspecially, please check for jsonvalue's [programming scenarios](./docs/en/10_scenarios.md).\n\n## Import\n\nUse following statements to import jsonvalue:\n\n```go\nimport (\n\tjsonvalue \"github.com/Andrew-M-C/go.jsonvalue\"\n)\n```\n\n## Quick Start\n\nSometimes we want to create a complex JSON object like:\n\n```json\n{\n  \"someObject\": {\n    \"someObject\": {\n      \"someObject\": {\n        \"message\": \"Hello, JSON!\"\n      }\n    }\n  }\n}\n```\n\nWith `jsonvalue`, It is quite simple to implement this:\n\n```go\n\tv := jsonvalue.NewObject()\n\tv.MustSet(\"Hello, JSON\").At(\"someObject\", \"someObject\", \"someObject\", \"message\")\n\tfmt.Println(v.MustMarshalString())\n\t// Output:\n\t// {\"someObject\":{\"someObject\":{\"someObject\":{\"message\":\"Hello, JSON!\"}}}\n```\n\nSimilarly, it is quite easy to create sub-arrays like:\n\n```json\n[\n  {\n    \"someArray\": [\n      \"Hello, JSON!\"\n    ]\n  }\n]\n```\n\n```go\n\tv := jsonvalue.NewArray()\n\tv.MustSet(\"Hello, JSON\").At(0, \"someObject\", 0)\n\tfmt.Println(v.MustMarshalString())\n\t// Output:\n\t// [{\"someObject\":[\"Hello, JSON\"]}]\n```\n\nIn opposite, to parse and read the first JSON above, you can use jsonvalue like this:\n\n```go\n\tconst raw = `{\"someObject\": {\"someObject\": {\"someObject\": {\"message\": \"Hello, JSON!\"}}}}`\n\ts := jsonvalue.MustUnmarshalString(s).GetString(\"someObject\", \"someObject\", \"someObject\", \"message\")\n\tfmt.Println(s)\n\t// Output:\n\t// Hello, JSON!\n```\n\nHowever, it is quite complex and annoying in automatically creating array. I strongly suggest using `SetArray()` to create the array first, then use `Append()` or `Insert()` to set array elements. Please refer go [godoc](https://godoc.org/github.com/Andrew-M-C/go.jsonvalue) or [Wiki](./docs/en/README.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAndrew-M-C%2Fgo.jsonvalue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAndrew-M-C%2Fgo.jsonvalue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAndrew-M-C%2Fgo.jsonvalue/lists"}