The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Type: Package
Title: Token-Oriented Object Notation (TOON)
Version: 0.0.1
Maintainer: Bernardo Lares <laresbernardo@gmail.com>
Description: Token-Oriented Object Notation (TOON) is a compact, human-readable serialization format designed for passing structured data to Large Language Models with significantly reduced token usage. It's intended for LLM input as a lossless, drop-in representation of JSON data.
Depends: R (≥ 3.5.0)
URL: https://github.com/laresbernardo/toon
BugReports: https://github.com/laresbernardo/toon/issues
RoxygenNote: 7.3.3
License: MIT + file LICENSE
Encoding: UTF-8
Config/testthat/edition: 3
Suggests: testthat (≥ 3.0.0)
NeedsCompilation: no
Packaged: 2025-11-05 17:42:04 UTC; bernardo
Author: Bernardo Lares [aut, cre]
Repository: CRAN
Date/Publication: 2025-11-10 08:20:02 UTC

Token-Oriented Object Notation (TOON)

Description

An R implementation for converting R objects (vectors, lists, data frames) into a custom, human-readable structured format called The Object Notation (TOON).

Author(s)

Maintainer: Bernardo Lares laresbernardo@gmail.com

See Also

Useful links:


Convert R Objects to TOON (Token-Oriented Object Notation)

Description

Converts a variety of R objects, including named lists (objects), unnamed lists, vectors (arrays), and data frames, into a character string formatted according to TOON (Token-Oriented Object Notation) specification.

Usage

as_toon(x, ...)

## S3 method for class 'toon'
print(x, ...)

Arguments

x

The R object to be converted. Supported types include:

  • Named lists

  • Unnamed lists and atomic vectors

  • Data frames

  • Primitive types (numeric, character, logical, NULL)

...

Additional arguments passed to specific S3 methods (e.g., internal indentation parameters).

Details

TOON is designed as a highly human-readable, lightweight data serialization format that supports nested structures.

Value

A character vector of class toon, containing the fully formatted TOON string.

Examples

# 1. Simple Object (Named List)
config_obj <- list(
  version = 1.0,
  is_active = TRUE,
  user_id = 99
)
as_toon(config_obj)

# 2. Expanded Array (Unnamed List)
items <- list(
  "apple",
  list(color = "red", weight = 150),
  "banana"
)
as_toon(items)

# 3. Data Frame
df <- data.frame(
  time = c(9.1, 15.4),
  action = c("login", "update"),
  success = c(TRUE, FALSE)
)
as_toon(df)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.