From a43653169dfc2517854f1bde75aa86be3854083f Mon Sep 17 00:00:00 2001
From: Andrea Zagli <azagli@libero.it>
Date: Wed, 9 Sep 2020 15:57:12 +0200
Subject: [PATCH] On load if no key fields returns the first array element.

---
 src/form.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/form.c b/src/form.c
index ecf0549..ad2b1d3 100644
--- a/src/form.c
+++ b/src/form.c
@@ -402,8 +402,14 @@ static JsonObject
 
 	if (k < 1)
 		{
+			/* TODO add a property to make this behaviour variable */
 			/* no key fields */
-			return NULL;
+			/* returns the first record */
+			ar = json_node_get_array (priv->root);
+			jnode = json_array_get_element (ar, 0);
+			obj = json_node_get_object (jnode);
+
+			return obj;
 		}
 
 	ok = FALSE;
-- 
2.49.0