xo::REST method typed_list_to_json (protected)

 <instance of xo::REST[i]> typed_list_to_json triples

Defined in packages/xooauth/tcl/rest-procs.tcl

Convert a list of triples (name, type, value) into json/bson notation. In case, there is mongodb support, use it, otherwise use a simple approximation. The "type" element of the triple is used to determine value formatting, such as e.g. quoting.

Parameters:
triples

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.
Source code:
if {[info commands ::mongo::json::generate] ne ""} {
    #ns_log notice "typed_list_to_json (mongo): $triples"
    return [::mongo::json::generate $triples]
} else {
    #ns_log notice "typed_list_to_json (tcl): $triples"
    set result ""
    foreach {name type value} $triples {
        lappend result [subst {"$name":[:typed_value_to_json $type $value]}]
    }
    return "{[join $result ,]}"
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: