A JSON document can have two structures.
- JSON Object: A name value pair or a key value pair. Names/Keys are only strings however values are of various types. Name and value are separated by a single colon (:). JSON Object is contained within the curly braces.
- JSON Array: An ordered sequence of values stored in square braces separated by a comma.
Types of Values: These types should be familiar to you and may not need any explanation. A value can be a
- Bool (True/False)
- JSON Object
- JSON Array
A JSON value can also be null.
The file which contains JSON data is stored with .json extension. Following is an example document named Example.json. Study it and identify different structures and value types.
Next is How to process JSON data in JAVA. We will use this example in our code. See you there.