Skip to content

Misleading JSON vs MDL Token Comparison #581

@hankxdev

Description

@hankxdev

The current documentation compares a verbose JSON representation against a highly optimized domain-specific syntax (MDL), then concludes that MDL is significantly more token-efficient.

Issues can be found in:

### JSON vs MDL

A simple entity definition illustrates the difference.

== Slide 8: Token Comparison

I think this comparison is misleading because the two examples are not equivalent in design goals or verbosity level.

Current Example

Verbose JSON:

{
  "entity": {
    "name": "Customer",
    "documentation": "Customer master data",
    "attributes": [
      {"name": "Name", "type": {"type": "String", "length": 200}},
      {"name": "Email", "type": {"type": "String", "length": 200}}
    ]
  }
}

Compact MDL:

/** Customer master data */
CREATE PERSISTENT ENTITY Sales.Customer (
    Name: String(200),
    Email: String(200)
);

Why This Is Problematic

The comparison mixes:

  • a generic serialization format (JSON)
  • with a purpose-built DSL (MDL)

The JSON example is also intentionally verbose:

  • repeated "type" nesting
  • repeated object wrappers
  • redundant field naming

A more compact JSON representation could be:

{
  "name": "Customer",
  "doc": "Customer master data",
  "fields": {
    "Name": "string(200)",
    "Email": "string(200)"
  }
}

Or even:

{
  "Customer": {
    "Name": "string(200)",
    "Email": "string(200)"
  }
}

At that point, the claimed token difference becomes much smaller.

Suggested Improvement

Instead of presenting this as “JSON vs MDL token efficiency,” I’d suggest framing it as:

  • MDL is more concise because it is a domain-specific language
  • JSON prioritizes generic interoperability and machine tooling
  • MDL prioritizes human-readable schema authoring

That would make the comparison feel more technically fair and less like an apples-to-oranges benchmark.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions