summaryrefslogtreecommitdiff
path: root/lib/json.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/json.h')
-rw-r--r--lib/json.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/json.h b/lib/json.h
index dd66a93..7f624b9 100644
--- a/lib/json.h
+++ b/lib/json.h
@@ -5,8 +5,7 @@
*
*/
-#ifndef __JSON_H
-#define __JSON_H
+#pragma once
//***************************************************************************
// Include
@@ -17,6 +16,7 @@
#include <jansson.h>
#include "db.h"
+#include "common.h"
//***************************************************************************
// JSON Helper Functions
@@ -28,9 +28,17 @@ int addFieldToJson(json_t* obj, cDbTable* table, const char* fname, int ignoreEm
int addFieldToJson(json_t* obj, cDbValue* value, int ignoreEmpty = yes, const char* extName = 0);
int getFieldFromJson(json_t* obj, cDbRow* row, const char* fname, const char* extName = 0);
+int jStringValid(const char* s);
+
const char* getStringFromJson(json_t* obj, const char* name, const char* def = 0);
int getIntFromJson(json_t* obj, const char* name, int def = na);
+int getBoolFromJson(json_t* obj, const char* name, bool def = false);
+long getLongFromJson(json_t* obj, const char* name, long def = na);
+double getDoubleFromJson(json_t* obj, const char* name, double def = na);
+
+int addToJson(json_t* obj, const char* name, const char* value, const char* def = "");
+int addToJson(json_t* obj, const char* name, long value);
+int addToJson(json_t* obj, const char* name, json_t* o);
#endif // USEJSON
-#endif // __JSON_H