Run artifact

workspace/targets/jq/blueprint/FEATURE-Conversion.md

FEATURE: Type and Conversion Builtins

FieldValue
Version20261028 V1
DescriptionInspect jq values and convert among numeric, Boolean, string, JSON, and Unicode representations.
Depends OnFEATURE-GeneratorControl.md
Providesjq type and conversion builtins
Consumesjq reductions and generator control

Purpose

Expose jq's type and conversion filters to programs, using the manual and corpus as the behavioral authority.

Behavior

Implement type, length, utf8bytelength, tonumber, toboolean, tostring, tojson, fromjson, explode, and implode, including their specified input types and errors. String length counts Unicode codepoints; UTF-8 byte length counts encoded bytes. Preserve jq's conversion and serialization behavior, including non-decnum numeric behavior and special numeric values. Unicode conversion follows jq's replacement behavior for invalid codepoints. Errors caught by jq programs are values and must match the corpus where it specifies them.

Programmatic Acceptance

=== AC conversion-conformance ===
Intent: Type, length, conversion, and Unicode filters execute their applicable corpus cases.
Suite: scoped
Requires: executable=python3; scope=test
Probe: --list
Probe Count: summary

import json import os import subprocess import sys

SELECT = r"^(?:utf8bytelength|\[\.\[\] \| length\]|\[\.\[\] \| try utf8bytelength catch \.\]|implode\|explode|fromjson \| isnan|tojson \| fromjson)$" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", SELECT, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": os.path.abspath("jq")}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) tally = report["summary"] assert sum(tally.values()) > 0, SELECT assert tally["fail"] == 0 and tally["error"] == 0, tally assert result.returncode == 0, result.returncode === END AC conversion-conformance ===

User Acceptance

Guardrails