diff options
Diffstat (limited to 'qobject/qjson.c')
-rw-r--r-- | qobject/qjson.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/qobject/qjson.c b/qobject/qjson.c index 9816a65..0df3120 100644 --- a/qobject/qjson.c +++ b/qobject/qjson.c @@ -76,6 +76,24 @@ QObject *qobject_from_jsonf(const char *string, ...) return obj; } +/* + * Parse @string as JSON object with %-escapes interpolated. + * Abort on error. Do not use with untrusted @string. + * Return the resulting QDict. It is never null. + */ +QDict *qdict_from_jsonf_nofail(const char *string, ...) +{ + QDict *obj; + va_list ap; + + va_start(ap, string); + obj = qobject_to(QDict, qobject_from_jsonv(string, &ap, &error_abort)); + va_end(ap); + + assert(obj); + return obj; +} + typedef struct ToJsonIterState { int indent; |