Yajl: Add a clause to set value in top level key
@@ -133,7 +133,8 @@ static int elektraGenOpenValue (yajl_gen g, const Key * next)
*/
static void elektraGenValue (yajl_gen g, Key * parentKey, const Key * cur)
{
- if (!elektraGenOpenValue (g, cur))
+ if (strcmp(keyName(parentKey), keyName(cur)) &&
+ !elektraGenOpenValue (g, cur))
{
ELEKTRA_LOG_DEBUG ("Do not yield value");
return;
@@ -259,6 +260,14 @@ int elektraYajlSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * par
yajl_gen_config (g, yajl_gen_beautify, 1);
#endif
+ if (ksGetSize (returned) == 1) {
+ elektraGenValue(g, parentKey, ksTail (returned));
+ int ret = elektraGenWriteFile (g, parentKey);
+ yajl_gen_free (g);
+ return ret;
+ }
+
+
if (elektraGenEmpty (g, returned, parentKey))
{
int ret = elektraGenWriteFile (g, parentKey);
