apache / apache/cloudstack

Question: Should we allow duplicate keys in our JSON objects ?

Open
#11,277 2 comments 0 reactions 0 assignees Claimed by @jbampton View on GitHub
type:question
Dominant language
Java
Stars
3.1k
Forks
1.4k
Avg merge
6d 19h
Merged PRs (30d)
32

Description

I was attempting to add the official pre-commit hook `check-json`

https://github.com/pre-commit/pre-commit-hooks?tab=readme-ov-file#check-json

And when testing the hook locally it showed two JSON files that had duplicate keys.

Should we standardize all our JSON files and enable checking or continue with the current inconsistent approach ?

Image

So it just shows two but there are many in the "GR" file

Image

Image

There is a discussion below about this:

https://stackoverflow.com/questions/21832701/does-json-syntax-allow-duplicate-keys-in-an-object

Contributor guide

Open the contributing guide

Research direction

Start with the proposed pre-commit check-json hook and the JSON files it reported, including the mentioned "GR" file, then review open PR #12245. Done means the project has a decided duplicate-key policy, affected JSON files follow it, and the check passes consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
build-system, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.