Jump to content

JSON/Data types

From Wikibooks, open books for an open world

Quick Review

[edit | edit source]

JSON is a notation language that stores data. An example is storing playerData.

Data Types

[edit | edit source]

Integers are easy to make. Just put the integer!

2, 10, 5

Strings are in double quotes

"Hello, World!"

Booleans are either true or false

true

Arrays

[edit | edit source]

Arrays are pretty much lists of data.

[1, 3, 10, 15]
["Hello","Goodbye","World"]

To get data from an array do this

array = ["Hello","World"] 
string0 = array[0] // array[0] = "Hello"
string1 = array[1] // array[1] = "World"
string2 = string0 + " " + string1 // Hello World

Objects

[edit | edit source]

And the best part! Objects, Objects are the core of JSON You can't have json without objects! To make a object just add curly brackets and (i can't come up with something, ill just show it in code)

{
    "MyName": "Streamer",
    "MyPassword": "catinabowl"
}