{
JsonNode *jnode;
- value = zak_form_element_unformat_gvalue (element, zak_form_element_get_value_gvalue (element));
+ if (ZAK_FORM_IS_ELEMENT_ARRAY (element))
+ {
+ guint l;
+ GPtrArray *ar_ar;
- jnode = json_node_new (JSON_NODE_VALUE);
- json_object_set_member (obj, zak_form_element_get_name (element), json_node_init_string (jnode, g_value_get_string (value)));
+ JsonNode *jnode_ar;
- g_value_unset (value);
+ jnode_ar = zak_utils_json_node_new_array ();
+
+ ar_ar = zak_form_element_array_get_elements (element);
+ for (l = 0; l < ar_ar->len; l++)
+ {
+ JsonNode *obj_ar;
+ JsonNode *obj_node_ar;
+
+ ZakFormElement *ar_element = (ZakFormElement *)g_ptr_array_index (ar_ar, l);
+
+ obj_ar = zak_utils_json_node_new_object ();
+ json_array_add_element (json_node_get_array (jnode_ar), obj_ar);
+
+ value = zak_form_element_unformat_gvalue (element, zak_form_element_get_value_gvalue (ar_element));
+
+ obj_node_ar = json_node_new (JSON_NODE_VALUE);
+ json_object_set_member (json_node_get_object (obj_ar), zak_form_element_get_name (ar_element), json_node_init_string (obj_node_ar, g_value_get_string (value)));
+
+ g_value_unset (value);
+ }
+
+ jnode = json_node_new (JSON_NODE_ARRAY);
+ json_object_set_member (obj, zak_form_element_get_name (element), json_node_init_array (jnode, json_node_get_array (jnode_ar)));
+ }
+ else
+ {
+ value = zak_form_element_unformat_gvalue (element, zak_form_element_get_value_gvalue (element));
+
+ jnode = json_node_new (JSON_NODE_VALUE);
+ json_object_set_member (obj, zak_form_element_get_name (element), json_node_init_string (jnode, g_value_get_string (value)));
+
+ g_value_unset (value);
+ }
}
}