ZakFormElement *element = (ZakFormElement *)g_ptr_array_index (elements, i);
if (zak_form_element_get_to_load (element))
{
- zak_form_element_set_value (element, json_object_get_string_member (obj, zak_form_element_get_name (element)));
+ JsonNode *jnode;
+
+ jnode = json_object_get_member (obj, zak_form_element_get_name (element));
+ if (ZAK_FORM_IS_ELEMENT_ARRAY (element)
+ && json_node_get_node_type (jnode) == JSON_NODE_ARRAY)
+ {
+ guint l;
+ guint j;
+ JsonArray *ar;
+
+ GString *str;
+
+ str = g_string_new ("");
+
+ ar = json_node_get_array (jnode);
+ l = json_array_get_length (ar);
+ for (j = 0; j < l; j++)
+ {
+ JsonObject *ar_obj;
+ GList *lst_membs;
+
+ ar_obj = json_array_get_object_element (ar, j);
+ lst_membs = json_object_get_members (ar_obj);
+
+ g_string_append_printf (str,
+ "%s{\"%s\",\"%s\"}",
+ str->len > 1 ? "," : "",
+ (gchar *)lst_membs->data,
+ json_object_get_string_member (ar_obj, (const gchar *)lst_membs->data));
+ }
+
+ zak_form_element_set_value (element, str->str);
+
+ g_string_free (str, TRUE);
+ }
+ else
+ {
+ zak_form_element_set_value (element, json_object_get_string_member (obj, zak_form_element_get_name (element)));
+ }
zak_form_element_set_as_original_value (element);
}
}