# Values Representations

Internet Object supports a rich set of **value types** that represent different kinds of data. Values are the fundamental building blocks of Internet Object documents, ranging from simple scalar values like numbers and strings to complex structured values like objects and arrays.

All values in Internet Object are designed to be:

* **Human-readable**: Easy to read and write by humans
* **Machine-parseable**: Efficiently processed by computers
* **Type-safe**: Clear distinction between different data types
* **Expressive**: Rich enough to represent complex data structures

## Value Categories

Internet Object values are organized into several categories:

### Scalar Values

Scalar values represent single, atomic pieces of data:

* [**Numbers**](https://docs.internetobject.org/the-structure/values/number) - Numeric values including integers, floats, and special numeric types
* [**Strings**](https://docs.internetobject.org/the-structure/values/string) - Text data with various encoding and formatting options
* [**Booleans**](https://docs.internetobject.org/the-structure/values/booleans) - True/false values
* [**Null**](https://docs.internetobject.org/the-structure/values/null) - Absence of value
* [**Base64 Byte Strings**](https://docs.internetobject.org/the-structure/values/base64) - Binary data encoded as Base64
* [**Date and Time**](https://docs.internetobject.org/the-structure/values/date-and-time) - Temporal values with ISO 8601 compatibility

### Structured Values

Structured values contain other values and provide organization:

* [**Objects**](https://docs.internetobject.org/the-structure/values/object) - Key-value pairs representing entities
* [**Arrays**](https://docs.internetobject.org/the-structure/values/array) - Ordered collections of values

## String Types

Internet Object provides several [string types](https://docs.internetobject.org/the-structure/values/string) to handle different text scenarios:

| Type                                                                                               | Syntax                 | Description                                   | Use Cases                                   |
| -------------------------------------------------------------------------------------------------- | ---------------------- | --------------------------------------------- | ------------------------------------------- |
| [**Regular Strings**](https://docs.internetobject.org/the-structure/values/string/regular-strings) | `"text"` or `'text'`   | Standard quoted strings with escape sequences | General text, user input, formatted content |
| [**Open Strings**](https://docs.internetobject.org/the-structure/values/string/open-strings)       | `unquoted text`        | Strings without quotes                        | Simple identifiers, natural language        |
| [**Raw Strings**](https://docs.internetobject.org/the-structure/values/string/raw-strings)         | `r"text"` or `r'text'` | Literal strings without escape processing     | File paths, regex patterns, code snippets   |

## Numeric Types

Internet Object supports various [numeric types](https://docs.internetobject.org/the-structure/values/number) for different precision and range requirements:

| Type                                                                                               | Syntax               | Description                     | Range                     |
| -------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------- | ------------------------- |
| [**Numbers**](https://docs.internetobject.org/the-structure/values/number/number)                  | `42`, `3.14`, `1e10` | Standard floating-point numbers | IEEE 754 double precision |
| [**BigInt**](https://docs.internetobject.org/the-structure/values/number/bigint)                   | `42n`, `0x1ABn`      | Arbitrary precision integers    | Unlimited                 |
| [**Decimal**](https://docs.internetobject.org/the-structure/values/number/decimal)                 | `42.5m`, `3.14159m`  | High-precision decimal numbers  | Configurable precision    |
| [**Special Values**](https://docs.internetobject.org/the-structure/values/number/nan-and-infinity) | `NaN`, `Inf`, `-Inf` | Non-finite numeric values       | IEEE 754 special values   |

## Temporal Types

Internet Object provides built-in support for [date and time values](https://docs.internetobject.org/the-structure/values/date-and-time):

| Type         | Syntax                     | Description            | Example                        |
| ------------ | -------------------------- | ---------------------- | ------------------------------ |
| **Date**     | `d'2024-03-20'`            | Date-only values       | `d'2024-03-20'`, `d'2024'`     |
| **Time**     | `t'14:30:45'`              | Time-only values       | `t'14:30:45.123'`, `t'09:00'`  |
| **DateTime** | `dt'2024-03-20T14:30:45Z'` | Combined date and time | `dt'2024-03-20T14:30:45.123Z'` |

## Binary Data

For binary data representation, Internet Object uses:

* [**Base64 Byte Strings**](https://docs.internetobject.org/the-structure/values/base64) (`b'SGVsbG8='`) - Efficient encoding of binary data as text

## Value Syntax Overview

Here's a quick reference of value syntax in Internet Object:

```ruby
# Scalar Values
42                                     # Number
"Hello, World!"                        # Regular string
'Single quotes work too'               # Regular string
unquoted string                        # Open string
r"C:\Users\file.txt"                   # Raw string
true                                   # Boolean
false                                  # Boolean
null                                   # Null
b'SGVsbG8gV29ybGQ='                    # Base64 byte string
d'2024-03-20'                          # Date
t'14:30:45'                            # Time
dt'2024-03-20T14:30:45Z'               # DateTime

# Structured Values
{                                      # Object
  name: "John Doe",
  age: 30,
  active: true
}

[1, 2, 3, "four", true]                # Array
```

## Type Coercion and Conversion

Internet Object maintains strict type boundaries:

* **No implicit conversion**: Values retain their declared types
* **Explicit parsing**: Type conversion happens during parsing based on syntax
* **Validation**: Type constraints are enforced during processing
* **Preservation**: Original format and type information is maintained

## Comments and Whitespace

Values can be accompanied by:

* **Comments**: `# This is a comment`
* **Whitespace**: Flexible spacing and indentation
* **Line breaks**: Multi-line value formatting

```ruby
{
  # User information
  name: "John Doe",    # Full name
  age: 30,             # Age in years

  # Contact details
  email: "john@example.com"
}
```

## Encoding and Character Support

Internet Object values support:

* **Unicode**: Full Unicode character set (UTF-8 encoding)
* **Escape sequences**: Standard escape codes in regular strings
* **Raw representation**: Literal character preservation in raw strings
* **Normalization**: Unicode normalization for consistent processing

## Navigation

### Quick Links

* **Scalar Types**: [Numbers](https://docs.internetobject.org/the-structure/values/number) • [Strings](https://docs.internetobject.org/the-structure/values/string) • [Booleans](https://docs.internetobject.org/the-structure/values/booleans) • [Null](https://docs.internetobject.org/the-structure/values/null) • [Binary Data](https://docs.internetobject.org/the-structure/values/base64) • [Date & Time](https://docs.internetobject.org/the-structure/values/date-and-time)
* **Structured Types**: [Objects](https://docs.internetobject.org/the-structure/values/object) • [Arrays](https://docs.internetobject.org/the-structure/values/array)

### By Use Case

* **Text Data**: [String Types](https://docs.internetobject.org/the-structure/values/string) - Regular, Open, and Raw strings
* **Numeric Data**: [Number Types](https://docs.internetobject.org/the-structure/values/number) - Standard, BigInt, Decimal, and Special values
* **Temporal Data**: [Date and Time](https://docs.internetobject.org/the-structure/values/date-and-time) - Dates, times, and datetimes
* **Binary Data**: [Base64 Byte Strings](https://docs.internetobject.org/the-structure/values/base64) - Encoded binary content
* **Logical Data**: [Booleans](https://docs.internetobject.org/the-structure/values/booleans) and [Null](https://docs.internetobject.org/the-structure/values/null)
* **Complex Data**: [Objects](https://docs.internetobject.org/the-structure/values/object) and [Arrays](https://docs.internetobject.org/the-structure/values/array)

## See Also

* [**Internet Object Structure Overview**](https://github.com/maniartech/InternetObject-specs/blob/gitbook/the-structure/README.md) - Understanding the overall document structure
* [**Schema Definition Language**](https://github.com/maniartech/InternetObject-specs/blob/gitbook/schema-definition-language/README.md) - Type definitions and validation
* [**Best Practices**](https://docs.internetobject.org/other/best-practices) - Guidelines for effective Internet Object usage
