What is an Object?
In object oriented programming, an "object" is a fundamental building block that represents a real-world entity with specific properties (data) and behaviors (functions/methods).
JSON Objects
A JSON object, short for JavaScript Object Notation object, is a fundamental data structure in the JSON data interchange format. It represents an unordered set of name/value pairs, also known as key/value pairs.
Object literals in JSON are always wrapped in `{ }` (curly brackets).
JSON object literals contains key/value pairs.
Each key/value pair is separated by a comma.
Keys and values are separated by a colon.
Keys must be strings, and values must be a valid JSON data type:
string
number
object
array
boolean
null
Key/Value Pairs
A key-value pair is a fundamental concept in programming and data storage, especially in dictionaries, maps, JSON, and databases.
Basic Idea:
A key-value pair consists of:
Key: A unique identifier.
Value: The data or information associated with that key.
Example in Real Life:
Think of a dictionary (the book):
The word is the key.
The definition is the value.
If you look up the key "apple" in the dictionary, the value might be "a fruit that grows on trees".
Breakdown of key-value pairs:
property_listing = {
"address": "123 Maple Street",
"price": 450000,
"bedrooms": 3,
"bathrooms": 2,
"square_feet": 1800,
"status": "For Sale"
}
Each key describes a property attribute, and each value holds the actual data about it.
"address" → "123 Maple Street"
"price"` → `450000`
"bedrooms" → `3`
"bathrooms" → `2`
"square_feet" → `1800`
"status" → "For Sale"
Why They're Useful:
Keys let you access values quickly.
They help organize data clearly.
Common in data structures, APIs, configurations, etc.
Entries
Object entries refer to the key-value pairs within an object. In JavaScript (and similar structures like JSON), these are called entries because each one is a single unit of information: a key and its corresponding value.
Think of it like this:
If an object is a box of labeled drawers, then:
The label is the
keyThe thing inside the drawer is the
valueEach drawer (label + content) is an
ent
Example:
Let’s say you have a JavaScript object:
const property = {
address: "123 Maple Street",
price: 450000,
bedrooms: 3
};
The entries of this object are:
`["address", "123 Maple Street"]`
`["price", 450000]`
`["bedrooms", 3]`
Why Object Entries Are Useful:
- You can loop through them to access both keys and values:
- You can use them for transforming data, building tables, or filtering properties dynamically.
Geometry & GeoJSON Features
GeoJSON stands for Geographic JSON—it's a format for encoding geographic data structures using JSON (JavaScript Object Notation).
A GeoJSON object may represent a region of space (a Geometry), a spatially bounded entity (a Feature), or a list of Features (a FeatureCollection).
In short, it's a way to represent points, lines, shapes, and features on a map using a structure that's easy to read, share, and use in code.
Any geometry you author in Giraffe is formatted as GeoJSON.
Key Parts of GeoJSON
A GeoJSON feature always includes:
type – Describes the kind of data (`"Feature"`, `"Point"`, `"Polygon"`, etc.)
geometry – The actual geographic shape (location, area, path)
properties – Extra info about the place or shape (name, population, type of site, etc.)
Example: A Point Feature
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-73.9857, 40.7484]
},
"properties": {
"name": "Empire State Building",
"city": "New York"
}
}
type: `"Feature"` means this is a single mappable thing.
geometry:
Point"` is the type of shape.
`coordinates` are `[longitude, latitude]`.
properties: Custom details you can attach—anything you want.
Types of Geometry
GeoJSON supports several geometry types:
Point – A single location
LineString – A path (like a road)
Polygon – An area (like a park, building, or entire city)
MultiPoint / MultiPolygon / MultiLineString – Groups of those
GeometryCollection – A mix of multiple geometry types
Object Literals versus GeoJSON Features
An object literal is just a basic JSON object—a set of key-value pairs used to represent *any* kind of data.
A GeoJSON Feature is a structured object used specifically to represent geographic data. It follows a standard format, so that mapping tools can understand and render it properly.
| Object Literal | GeoJSON Feature |
Purpose | Generic data | Geospatial data |
Structure | Flexible | Must follow GeoJSON format |
Must include | Nothing specific | `type`, `geometry`, `properties` |
Can include location? | Yes, but custom format | Yes, standardized format |
Mapping tools compatible? | Not directly | Yes! Fully supported |

