Natural Language to JSON Converter (nl2json) for Openclaw

A high-precision skill for AI agents that converts conversational natural language into machine-readable JSON parameters based on custom templates.

yingjiusheng
v1.0.1
Mar 6, 2026
0
736
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install nl2json

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install nl2json using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Natural Language to JSON Converter (nl2json)?

The nl2json skill is a specialized utility designed to bridge the gap between human conversation and structured data processing. As a core part of the Openclaw Skills ecosystem, it allows AI agents to extract specific entities, parameters, and intent from natural language and format them into a strict JSON schema. It is particularly effective for systems that require reliable data input for APIs or database queries without forcing users to speak in rigid commands.

This skill excels at maintaining consistency by prioritizing a template-based extraction method. By reading a default JSON template, the skill ensures that every output contains the necessary fields, regardless of the input complexity. It also features sophisticated time-normalization logic and context awareness, making it an indispensable tool for developers building interactive data-driven agents.

Natural Language to JSON Converter (nl2json) Use Cases

  • Automating public opinion monitoring by extracting keywords, platforms, and time ranges from user requests.
  • Powering advanced search interfaces where natural language queries must be converted into structured database filters.
  • Streamlining news and media aggregation by identifying subjects, sources, and sentiment parameters.
  • Enhancing multi-turn conversational agents that need to update specific parameters like quantity or date while remembering the previous context.

How Natural Language to JSON Converter (nl2json) Works

  1. The skill begins by loading the templates/default.json file to understand the target structure and required fields.
  2. It analyzes the conversation history to determine if the current user input is a brand-new request or a partial update to a previous query.
  3. Key information is extracted from the natural language text, mapping identified entities to the specific fields defined in the template.
  4. Any relative time descriptions, such as yesterday or last week, are calculated based on the current system date and converted into a standard YYYY-mm-dd H:i:s format.
  5. If context inheritance is triggered, the skill merges the new parameters with the existing state to maintain continuity.
  6. The final structured JSON object is generated, ensuring all fields (even empty ones) are present and correctly formatted for immediate programmatic use.

Natural Language to JSON Converter (nl2json) Setup

To deploy this skill within your AI environment, ensure your template directory is initialized and the default schema is defined.

# Create the templates directory
mkdir -p templates

# Define your default JSON structure
echo '{
  "input": "string",
  "question_name": "string",
  "other": {}
}' > templates/default.json

Once the template is in place, the agent can begin utilizing Openclaw Skills to process incoming natural language strings.

Natural Language to JSON Converter (nl2json) Data Schema & Taxonomy

The skill produces a structured output that mirrors the provided template. Below is the standard taxonomy used by the default implementation:

Field Type Description
input string The raw natural language input provided by the user.
question_name string A descriptive title of the query, updated during context inheritance.
other object A nested object containing extracted metadata like source, subject, and limit.
start_time string The normalized start date in YYYY-mm-dd H:i:s format.
end_time string The normalized end date in YYYY-mm-dd H:i:s format.

Natural Language to JSON Converter (nl2json) Advanced Features

  • Contextual State Management: Automatically inherits parameters from previous turns if the user provides a partial follow-up.
  • Robust Time Normalization: Handles a wide array of relative time expressions and converts them into precise timestamps.
  • Strict Schema Enforcement: Guarantees that the output JSON always matches the template structure, preventing parsing errors in downstream systems.
  • Intelligent Entity Mapping: Capable of identifying and categorizing complex parameters like sentiment, data types, and platform sources from casual speech.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*