Whether you choose the first or the third option depends on your use case. If you are modeling many different instances of the same type of thing, choose the first. For example, you have a list of people. If you are modeling many different attributes of one thing, choose the third. You can have repeated keys in the first format, but not in the third.

The second option is terrible, and I've yet to find an appropriate use case for it. The reason it's terrible, in addition to being more verbose, is that for single-level JSON, it breaks most libraries' automatic conversion to a dictionary/map. For deeply-nested JSON, it breaks the XPath-like query interface.

This makes it a pain to work with. And if you don't know your keys at compile time, you will want a dictionary or XPath interface, because you won't be able to convert it to a class. It may not seem like a big deal now, but the longer you have a data format, the harder it will be to change.

Answer from Karl Bielefeldt on Stack Exchange
Discussions

Multiple key / value pairs from json
I have a json object like this: Is it possible, to push various key / value pairs to influxdb in one input plugin.For example a c f Many thanks More on community.influxdata.com
🌐 community.influxdata.com
1
0
March 18, 2020
May I know how can go get the keys of nested JSON key value pairs of a specific value?
May I know how can go get the keys of nested JSON key value pairs of a specific value? For example, {“a”:[“Math”], “b”:, “c”:[“Science”:[“Physics”]] } I wish to get output something like, [“c”][“Science”] or similar so that I can automate the clicking of respective ... More on forum.uipath.com
🌐 forum.uipath.com
0
0
April 5, 2022
Storing a Key Value Array into a compact JSON string - Stack Overflow
I want to store an array of key value items, a common way to do this could be something like: // the JSON data may store several data types, not just key value lists, // but, must be able to ident... More on stackoverflow.com
🌐 stackoverflow.com
How to look up for a key value pair in JSON object using SQL?
There is an instance of the same ... is dynamic, it can be in either places throughout the json objects. Normally we would use a path based approach as we know that at certain path we'll find the key value pair.... More on learn.microsoft.com
🌐 learn.microsoft.com
1
0
October 27, 2021
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
How to add a key/value pair to an existing json file?
September 8, 2023 - The Json file would look some like this: { “data”: [ { "id": "1700148573403304137", "text": "Hi ! " }, { "id": "1700147255322259501", "text": "Hello" } ] For the final I want to add something like: “te…
🌐
DEV Community
dev.to › tooleroid › master-json-key-value-pairs-a-complete-guide-59b
Master JSON Key-Value Pairs: A Complete Guide - DEV Community
December 23, 2024 - Here's your menu of options: { "string_example": "Hello, World!", "number_example": 42, "boolean_example": true, "array_example": [1, 2, 3], "object_example": { "nested": "value" }, "null_example": null }
🌐
InfluxData Community
community.influxdata.com › telegraf
Multiple key / value pairs from json - Telegraf - InfluxData Community Forums
March 18, 2020 - I have a json object like this: Is it possible, to push various key / value pairs to influxdb in one input plugin.For example a c f Many thanks
🌐
Harvard
cscie12.dce.harvard.edu › lecture_notes › 2021-spring › 20210413 › slide5.html
Slide 5 - JS Data Structures - array and "object" (key/value pair) § Session 11 - JavaScript, Part 4
{ "apples" : ['Macoun','Empire','Honey Crisp','Albemarle Pippin'], "oranges" : ['Naval Orange','Tangelo','Clementine','Valencia Orange'] } A data format widely used in Ajax is JSON -- this format is used to pass data from the web server to the browser, and it is in a format that is easily worked ...
🌐
RestfulAPI
restfulapi.net › home › json › json syntax
JSON Syntax - REST API Tutorial
November 3, 2023 - Name-value pairs have a colon between them as in "name" : "value". JSON names are on the left side of the colon. They need to be wrapped in double quotation marks, as in “name” and can be any valid string. Within each object, keys need to be unique.
Find elsewhere
🌐
Micro Focus
microfocus.com › documentation › silk-performer › 195 › en › silkperformer-195-webhelp-en › GUID-6AFC32B4-6D73-4FBA-AD36-E42261E2D77E.html
JSON Object Structure
A key-value pair consists of a key and a value, separated by a colon (:). The key is a string, which identifies the key-value pair. The value can be any of the following data types: { } //Empty JSON object { “StringProperty”: “StringValue”, “NumberProperty”: 10, “FloatProperty”: 20.13, “BooleanProperty”: true, “EmptyProperty”: null } { “NestedObjectProperty”: { “Name”: “Neste Object” }, “NestedArrayProperty”: [10,20,true,40] }
🌐
DigitalOcean
digitalocean.com › community › tutorials › an-introduction-to-json
An Introduction to JSON | DigitalOcean
August 24, 2022 - These objects and arrays will be passed as values assigned to keys, and may be comprised of key-value pairs as well. In the following users.json file, for each of the four users ("sammy", "jesse", "drew", "jamie") there is a nested JSON object passed as the value for each of them, with its own nested keys of "username" and "location" that relate to each of the users. Each user entry in the following code block is an example of a nested JSON object:
🌐
Squarespace
developers.squarespace.com › what-is-json
What is JSON? — Squarespace Developers
So that means "foo" and the corresponding object are a key/value pair. ... The key/value pair "bar" : "Hello" is nested inside the key/value pair "foo" : { ... }. That's an example of a hierarchy in JSON data.
🌐
UiPath Community
forum.uipath.com › help › activities
May I know how can go get the keys of nested JSON key value pairs of a specific value? - Activities - UiPath Community Forum
April 5, 2022 - For example, {“a”:[“Math”], “b”:, “c”:[“Science”:[“Physics”]] } I wish to get output something like, [“c”][“Science”] or similar so that I can automate the clicking of respective ...
🌐
Pluralsight
pluralsight.com › tech insights & how-to guides › tech guides & tutorials
How to Display Key and Value Pairs from JSON in ReactJS | Pluralsight
April 24, 2024 - Here comes the most tricky part of the JSON name-value pair rendering. React does not directly allow us to render any object in JSX. If we mistakenly do that, it will result in the following error: Objects are not valid as a React child (found: object with keys { a, b, c }).
🌐
W3Schools
w3schools.com › js › js_json_objects.asp
JSON Object Literals
JS Examples JS HTML DOM JS HTML Input JS HTML Objects JS HTML Events JS Browser JS Editor JS Exercises JS Quiz JS Website JS Syllabus JS Study Plan JS Interview Prep JS Bootcamp JS Certificate JS Reference ... JSON object literals are surrounded by curly braces {}. JSON object literals contains key/value pairs...
🌐
Coddy Reference
ref.coddy.tech › home › json › json key-value pairs
JSON Key-Value Pairs | Coddy Reference
5 days ago - Learn about JSON key-value pairs, their syntax, usage, and importance in JSON data structures. Explore examples and best practices for working with key-value pairs in JSON.
🌐
Medium
medium.com › @lowenthal_jason › key-value-pairs-bafb734cf33c
Key/ Value Pairs. At the root of all JSON you’ll find… | by Jason Lowenthal | Medium
September 1, 2016 - At the root of all JSON you’ll find structures of Key/Value pairs. There’s more than one valid way to represent data this way, but I’m of the quite strong stance that one way is much stronger as an API data set than the other. I want to take a minute to compare two identical data sets, ...
🌐
Qlik Community
community.qlik.com › t5 › Talend-Studio › How-to-process-anonymous-JSON-for-Key-Value-pairs › td-p › 2336347
How to process anonymous JSON for Key Value pairs - Qlik Community - 2336347
November 15, 2024 - That is your JSON example as a String and 3 lines of code to read it into a JSONObject, an Iterator to iterate over the JSONObject keys and a while loop to allow the processing of each item in the JSON. The Main Code can be seen below. I have set up 2 columns (key and value) to output the records ...