Created
November 3, 2025 17:25
-
-
Save natebirkholz/c31e5c4e16f5bd2303f39841e8e15056 to your computer and use it in GitHub Desktop.
Explaining basic JSON syntax:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Json is always contained between curly braces: | |
| { | |
| "Text here" | |
| } | |
| Inside the curly braces you can have a "list" or array, this list has a string, a number, and a boolean. Note that the elements of a lost are separated by commas: | |
| { | |
| "Text here", | |
| 245, | |
| false | |
| } | |
| You can also have a list inside of a list, which nests new curly braces inside the outer curly braces. This shows the first list, but I added another, nested list to the end of the first inside its own curly braces: | |
| { | |
| "Text here", | |
| 245, | |
| false, | |
| { | |
| "More text", | |
| 365.24, | |
| true | |
| } | |
| } | |
| ---- | |
| The other key element of JSON are "objects", objects are "key-value pairs" -- a string that is the name for the element and then a value. An object is always inside curly braces ALSO, so be ware you need to take a moment to see which you are looking at. | |
| { | |
| "key" : "value" | |
| } | |
| You can have multiple key-value pairs in an object, just add commas between them. A key must alwayds be a string, and the values can be strings, numbers, booleans, arrays, or other objects, and values can be mixed types: | |
| { | |
| "Key 1" : "Value 1", | |
| "Key 2" : 952, | |
| "Key 3" : false | |
| } | |
| Here is an object with another object inside it. Note that inside the curly braces, the nested key-value pairs can have the same keys as the contaiing, outer object: | |
| { | |
| "Key 1" : "Value 1", | |
| "Key 2" : 952, | |
| "Key 3" : false, | |
| "Key 4" : { | |
| "Key 1" : "Value 1", | |
| "Key 2" : 952, | |
| "Key 3" : false | |
| } | |
| } | |
| Keys are case-sensitive, so of course "Key 1" and "key 1" are different. But you can't have "Key 1" and an identical "Key 1" inside the same object: | |
| { | |
| "Key 1" : "Value 1", | |
| "Key 2" : 952, | |
| "Key 3" : false, | |
| "Key 1" : "Value 2" | |
| } | |
| This would be incorrectly-structured JSON due to the repeated key name. | |
| You won't be accessing any object or list values yourself, the agent does that for you I believe, so I wont explain that unless you need it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment