diff --git a/build b/build index e440e5c..7813681 100644 --- a/build +++ b/build @@ -1 +1 @@ -3 \ No newline at end of file +5 \ No newline at end of file diff --git a/src/framework/MicroService.h b/src/framework/MicroService.h index 11350b6..c6f6893 100644 --- a/src/framework/MicroService.h +++ b/src/framework/MicroService.h @@ -204,6 +204,10 @@ namespace OpenWifi::RESTAPI_utils { Obj.set(Field, Arr); } + inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, int Value) { + Obj.set(Field, Value); + } + template void field_to_json(Poco::JSON::Object &Obj, const char *Field, const T &Value) { Poco::JSON::Object Answer; Value.to_json(Answer); @@ -222,6 +226,12 @@ namespace OpenWifi::RESTAPI_utils { } } + inline void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char *Field, int &Value) { + if(Obj->isObject(Field)) { + Value = Obj->get(Field); + } + } + template void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char *Field, T &Value) { if(Obj->isObject(Field)) { Poco::JSON::Object::Ptr A = Obj->getObject(Field);