Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jar-b/jsondup
Detect duplicate keys in a JSON object.
https://github.com/jar-b/jsondup
Last synced: 10 days ago
JSON representation
Detect duplicate keys in a JSON object.
- Host: GitHub
- URL: https://github.com/jar-b/jsondup
- Owner: jar-b
- License: mit
- Created: 2023-09-12T17:52:14.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-20T18:08:10.000Z (about 1 year ago)
- Last Synced: 2024-10-12T20:58:56.254Z (24 days ago)
- Language: Go
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsondup
[![build](https://github.com/jar-b/jsondup/actions/workflows/build.yml/badge.svg)](https://github.com/jar-b/jsondup/actions/workflows/build.yml)Detect duplicate keys in a JSON object.
## Installation
```console
go install github.com/jar-b/jsondup/cmd/jsondup@latest
```## Usage
```console
$ jsondup -h
Detect duplicate keys in a JSON object.Usage: jsondup [filename]
```## Examples
### Simple
Given the following content in `dup.json`:
```json
{
"a": "foo",
"a": "bar"
}
``````console
$ jsondup dup.json
2023/09/12 15:53:29 duplicate key "a"
```### Nested
A more complex example might be an AWS IAM policy document with duplicated `Condition` keys:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:PutObject",
"Resource": "*",
"Condition": {
"StringEquals": {
"s3:prefix": ["one/", "two/"]
},
"StringEquals": {
"s3:versionid": "abc123"
}
}
}
]
}
``````console
$ jsondup iam.json
2023/09/12 15:57:15 duplicate key "Statement.0.Condition.StringEquals"
```