util::json::gen (public, deprecated)

 util::json::gen value

Defined in packages/acs-tcl/tcl/json-procs.tcl

Deprecated. Invoking this procedure generates a warning.

Generate JSON from the legacy tagged Tcl list format. Prefer ns_json value with explicit JSON types for new code. When ns_json is available, this wrapper encodes the legacy values with the native serializer. Strings that look like JSON numbers, booleans or null are still inferred as those types.

Parameters:
value (required)
A two-element object/array Tcl list.
Returns:
A JSON string.

Partial Call Graph (max 5 caller/called nodes):
test_legacy_json_generation legacy_json_generation (test acs-tcl) util::json::gen util::json::gen test_legacy_json_generation->util::json::gen acs::icanuse acs::icanuse (public) util::json::gen->acs::icanuse ad_log_deprecated ad_log_deprecated (public) util::json::gen->ad_log_deprecated util::json::gen_inner util::json::gen_inner (private) util::json::gen->util::json::gen_inner util::json::legacy_value_to_json_type util::json::legacy_value_to_json_type (private) util::json::gen->util::json::legacy_value_to_json_type

Testcases:
legacy_json_generation
Source code:
ad_log_deprecated proc util::json::gen
    if { [llength $value] != 2 } {
        return -code error "Ill-formed JSON object: length in gen is [llength $value]"
    }
    if {[::acs::icanuse "ns_json"]} {
        lassign [legacy_value_to_json_type $value] type payload
        return [ns_json value -type $type -- $payload]
    }
    return [util::json::gen_inner $value]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: