xowiki::formfield::repeatContainer instproc json_value (public)
<instance of xowiki::formfield::repeatContainer> json_value \ value
Defined in /var/www/openacs/packages/xowiki/tcl/json-procs.tcl
Recursively export repeated occurrences as a JSON array in numeric occurrence order. Omit the occurrence-zero template and create field metadata for stored occurrences on demand. Invalid legacy values remain strings.
- Parameters:
- value (required)
- Stored dictionary of occurrence names and values.
- Returns:
- Two-element ns_json type/payload pair; array payloads contain triples.
- Testcases:
- No testcase defined.
Source code: if {[catch {dict size $value}]} { return [list string $value] } set occurrences {} dict for {name v} $value { set prefix ${:name}. if {[string first $prefix $name] != 0} { return [list string $value] } set index [string range $name [string length $prefix] end] if {![regexp {^(0|[1-9][0-9]*)$} $index]} { return [list string $value] } # Occurrence zero is the client-side template, not content. if {$index > 0} { lappend occurrences [list $index $name $v] } } set entries {} set i 0 foreach occurrence [lsort -integer -index 0 $occurrences] { lassign $occurrence index name v set c "" foreach component ${:components} { if {[$component name] eq $name} { set c $component break } } if {$c eq ""} { set c [:require_component $index] } lassign [$c json_value $v] type payload lappend entries $i $type $payload incr i } return [list array $entries]XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)