-
Notifications
You must be signed in to change notification settings - Fork 39
What's a JSON file
JSON file is a file that will hold data organized in a standard way. In short, JSON is a way to store data. That's all, it's not a programming language.
JSON consists of various brackets, commas, and double quotes. And mostly, JSON structures will bring data in pairs, like key-values (just like dictionaries). Example:
{
"key": "value"
}
Whenever you have data enclosed by curly braces, you have an object
. So, above, the outer curly brackets wrap around the whole object to make sure all the data stays together in one object. The left text string, or "key" is simply a name and can be any valid name. Keys are always enclosed by double quotes.
JSON supports different types of data when defining the values. They are object
, array
, string
, number
, boolean
, and null
.
{
"string": "some text",
"number": 5.67,
"boolean": true,
"empty": null
}
- A string is a set of characters, or simply, text.
- A number is a straightforward number without double quotes around it.
- A boolean can be either
true
orfalse
. Note that it is written in all lowercase and without double quotes. - A null value is an empty value. This might be useful if the value isn’t known yet but the object might need to contain a specific key so that all objects have the same keys.
Also, note the commas after each value. This lets JSON know that it is looking at the next value. This is needed because JSON files can be minified to reduce disk space. In most cases, minifying will remove all linebreaks and spaces so letting JSON know what is the next value is very important.
Arrays, or lists, are a very useful data type that holds some data together in sequence. A list is made with brackets [
and ]
. You can put any value in between and separate them with commas. Example:
{
"name": "John Doe",
"grades": [5, 6, 5.5, 1, 7, 7.5],
"passed": true
}
Please notice that the array items can be of any type, including objects and even other arrays:
{
"name": "John Johnsson",
"studentNumber": "09846115",
"classes": [
{
"name": "Agriculture",
"points": 4,
"year": 2021
},
{
"name": "Computer science",
"points": 4,
"year": 2021
}
]
}
We can define JSON objects like we have made so far within JSON objects. This is called nesting.
{
"name": "John Doh",
"course": {
"name": "Information Technologies",
"points": 4,
"year": 2020,
"retake": false
}
}
Here we create an object of another student with a familiar name. The student follows a course. This course can be an object (which it is in this example) with more key-value pairs like we’ve done before.
Notice the curly brackets we use within our object to create a nested object.
JSON is a way of storing data in .json files. It is much more advanced and more powerful than CSV or Excel sheets. The syntax can be harder to learn but once you get the hang of it you will never forget.
Reference: JSON in plain English
- Home
- Introduction for developers
- Tutorials
- Game initialization settings
- Map settings
-
Game Events
- Add item to party event
- Audio play event
- Battle event
- Branch event
- Camera fade event
- Camera follow event
- Camera move event
- Camera shake event
- Casting aura event
- Change collision layer event
- Char animation play event
- Char blend mode event
- Char exp event
- Char fall event
- Char hue event
- Char item manipulation event
- Char level change event
- Char rotation event
- Char shadow visibility event
- Char tween position event
- Chest event
- Colorize char event
- Colorize map event
- Control bgm event
- Create storage var event
- Custom collision body event
- Destroyer event
- Dialog event
- Djinn get event
- Djinn set status event
- Emoticon event
- Event activation event
- Event caller event
- Event holder event
- Event loop event
- Exit Sand mode event
- Face direction event
- Flame char event
- Generic sprite event
- Grant ability event
- IO anim play event
- IO tween position event
- Item checks event
- Jump event
- Layer tween event
- Layer visibility event
- Look event
- Main chars join split event
- Map blend mode event
- Map opacity event
- Move event
- Outline char event
- Particles event
- Party join event
- Permanent status event
- Psynergy stone event
- Set char activation event
- Set char collision event
- Set char visibility event
- Set IO activation event
- Set IO collision event
- Set IO visibility event
- Set NPC collision event
- Set party coins event
- Set value event
- Storage change event
- Summon event
- Teleport event
- Tile event manage event
- Timer event
- Tint char event
- Databases
- Code reference