Skip to content

Support JSON null values (auto-convert to Python None) in toon-python encoding flow #49

@raksha18-vimo

Description

@raksha18-vimo

Problem Statement

Hi team,
I’m using toon-python to encode tool outputs into TOON. I often receive payloads in JSON format where missing values appear as null, for example:
{
"abc": null,
"xyz": null
}

The only workaround is converting null → None manually, or converting null into "null" (string), which changes the meaning of the data.

Proposed Solution

Request

Could toon-python support one of the following?

Provide a helper function such as:

toon_format.encode_json(json_string: str)

that parses JSON and converts null → None before encoding.

Or provide a utility:

toon_format.loads(json_string)

similar to json.loads(), but TOON-friendly.

Or document clearly that None must be used and provide an official conversion snippet.

Why this matters

This is a very common integration case when data originates from:

  1. LLM tool outputs
  2. APIs
  3. logs / stored JSON payloads
  4. Having built-in support would prevent frequent encoding failures and improve developer experience.

Alternatives Considered

No response

SPEC Compliance

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions