JSON
- rfc6901 - JavaScript Object Notation (JSON) Pointer
- automerge/automerge
- A JSON-like data structure that can be modified concurrently by different users, and merged again automatically.
- Extension
- geojson
- hljson
- json5
- Variants
- yaml
- toml
- jsonata-js/jsonata
- JSON query and transformation language
- https://jsonata.org/
- jsonnl - JSON with new line
- https://jsonlines.org/
- Standard MIME content-type #19
.jsonl
,application/jsonl
- jsonlines.org and ndjson.org wardi/jsonlines#22
- ndjson - Newline delimited JSON
- ⚠️ 不活跃
- ndjson/ndjson-spec
- wikipedia JSON streaming
- line delimited JSON
- concatenated JSON
- length-prefixed JSON
Schema
- json-schema
- jsonschema2pojo
- Json Schema 生成 Pojo
- app.quicktype.io
Patch
- rfc6902 - JSON Patch
application/json-patch+json
- 基于操作 - op, path, value - 更适用于复杂场景
- op = add, remove, replace, move, copy, test
- test 用于断言,断言失败则操作失败
- 例如
{ "op": "test", "path": "/a/b/c", "value": "foo" }
- 例如
- rfc7396 - JSON Merge Patch
application/merge-patch+json
- 基于文档合并 -
{"key":"new value"}
- 适用于简单场景 - 设置 key 为 null 表示删除
- 数组只能替换
- 合并操作不会出错
rfc7386
- jsonpatch
- flipkart-incubator/zjsonpatch
- https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#patch-operations
application/strategic-merge-patch+json
- 基于 Merge Patch
- list 合并基于 name 去重合并,而不是直接替换
- patchStrategy
$patch
- replace, delete
- Strategic Merge Patch
Diff
- DoneDeal0/superdiff
- [benjamine/jsondiffpatch](- https://github.com/benjamine/jsondiffpatch)
- andreyvit/json-diff
- MIT, CoffeeScript
- npm:json-diff
- google/diff-match-patch
- plain text
- trailofbits/graphtage
- LGPLv3, Python
- JSON, JSON5, XML, HTML, YAML, CSV
- sanity-io/mendoza
- https://extendsclass.com/json-diff.html
- zgrossbart/jdd
- https://json-diff.com/
- mattphillips/deep-object-diff
- flitbit/diff
- Starcounter-Jack/JSON-Patch
- kpdecker/jsdiff
- Text Diff
Command line tools
ETL
- jsonata-js/jsonata
- JSONata query and transformation language
- bazaarvoice/jolt
- Apache-2.0, Java
- JOLT - JsOn Language for Transform
- jmespath
Misc
- WebReflection/JSONH
- Reducce JSON Size
- hpack
FAQ
JSON Patch and JSON Merge Patch
- rfc6902 vs rfc7396
- 参考
时间格式选择
- ISO 8601
new Date().toJSON()
- 2018-04-16T05:24:53.603Z
- Java
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.CHINA)
- The “right” JSON date format
new Date().toJSON() === new Date().toISOString();