author | Pierre-Yves Ritschard <pyr@spootnik.org> | |
Mon, 1 Dec 2014 07:49:00 +0000 (08:49 +0100) | ||
committer | Pierre-Yves Ritschard <pyr@spootnik.org> | |
Mon, 1 Dec 2014 07:49:00 +0000 (08:49 +0100) |
curl_json plugin: don't complain about not finding expected maps in arrays
1 | 2 | |||
---|---|---|---|---|
src/curl_json.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc src/curl_json.c
index e99500aa554a3bc9147b664229f73cd44749d011,b7eaf399c4ce3abfc45f5df40fac72a0abd4f8bf..b79c999e2d8bf51116cf1e618a7229843c364f6d
--- 1/src/curl_json.c
--- 2/src/curl_json.c
+++ b/src/curl_json.c
buffer[sizeof (buffer) - 1] = 0;
if ((key == NULL) || !CJ_IS_KEY (key)) {
- if (key != NULL)
+ if (key != NULL && !db->state[db->depth].in_array/*can be inhomogeneous*/)
NOTICE ("curl_json plugin: Found \"%s\", but the configuration expects"
" a map.", buffer);
- cj_cb_inc_array_index (ctx, /* update_key = */ 0);
- return (CJ_CB_CONTINUE);
- } else {
+ cj_cb_inc_array_index (ctx, /* update_key = */ 1);
+ key = db->state[db->depth].key;
+ if (key == NULL) {
+ return (CJ_CB_CONTINUE);
+ }
+ }
+ else
+ {
cj_cb_inc_array_index (ctx, /* update_key = */ 1);
}