Skip to content
blead edited this page Oct 18, 2017 · 2 revisions

Data Format

Not JSON

The format is not JSON. Each data file is basically a bunch of JavaScript objects listed together in a single file. By standard, JSON requires keys to be strings (enclosed in quotes) and cannot contain comments. So if we are going by that logic, data files are simply JavaScript or maybe JSON5.

Object Notation Basics

If you are familiar with JavaScript or JSON in general, you may skip this section.

Objects

An object is a collection of name/value pairs. It begins with { (left brace) and ends with } (right brace). : (colon) associates each name to its value. Name/value pairs are separated by , (comma).

Example:

{ name0: 0, name1: 1, just: 2, counting: 3, numbers: 4 }

Arrays

An array is an ordered collection of values. It begins with [ (left bracket) and ends with ] (right bracket). Values are separated by , (comma).

Example:

[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]

Values

Commonly used data types are listed below. Other data types exist but are not included to keep this page concise.

Numbers

A number represents a decimal numeral. Negative values are allowed. E-notation is also allowed.

Example:

2147483648
-5
1.6180339887
2e31
10e-5

Strings

A string represents a sequence of zero or more Unicode characters enclosed in quotes. Both double quotes and single quotes work. For consistency, one would prefer using similar style of quotes for similar situations.

Some special characters can be written using backslash escapes, for example, \" represents " (double quote), \' represents ' (single quote), \\ represents \ (backslash) itself.

Example:

"Hello World!"
""
"The above string is an empty string. It contains nothing."
"5 backslash characters: \\\\\\\\\\"
"日本語も可能です"

Booleans

A Boolean represents a logical truth value. It can only be either true or false.

Example:

true
false

Practical Example

{id:1,name:"Frog Lander BD",cost:60,capa:130,hp:60,str:4,tec:3,wlk:8,fly:7,tgh:3,wbid:5,cartridge:{hpup:29,lv1:"3*8@25|7@20|10@15|9@20|24@10|17@15|18@15",lv6:"16@20|11@20|28@30",lv9:"20@15|15@15|27@40"}}

The whole snippet represents a single object with the following name/value pairs:

name: value (type)

  • id: 1 (number)
  • name: "Frog Lander BD" (string)
  • cost: 60 (number)
  • capa: 130 (number)
  • hp: 60 (number)
  • str: 4 (number)
  • tec: 3 (number)
  • wlk: 8 (number)
  • fly: 7 (number)
  • tgh: 3 (number)
  • wbid: 5 (number)
  • cartridge: {hpup:29,...,lv9:"20@15|15@15|27@40"} (nested object)
    • hpup: 29 (number)
    • lv1: "3*8@25|7@20|10@15|9@20|24@10|17@15|18@15" (string)
    • lv6: "16@20|11@20|28@30" (string)
    • lv9: "20@15|15@15|27@40" (string)

Clone this wiki locally