Function which converts native bundle object into json.
[Verification] Code compiles without error.
Change-Id: I932971d40309017c7ba7be9d677a41147ac5b3c2
Signed-off-by: Michal Michalski <m.michalski2@partner.samsung.com>
return PlatformResult(ErrorCode::NO_ERROR);
}
+PlatformResult BundleToJson(bundle* bundle_data, picojson::object* json) {
+ picojson::array array_data;
+ bundle_foreach(bundle_data, BundleJsonIterator, &array_data);
+
+ for (auto& elem: array_data) {
+ (*json)[elem.get("key").get<std::string>()] = elem.get("value");
+ }
+
+ return PlatformResult(ErrorCode::NO_ERROR);
+}
+
PlatformResult JsonToBundle(const picojson::array& json, bundle* bundle_data) {
ScopeLogger();
for (const auto& item: json) {
void BundleJsonIterator(const char* key, const int type, const bundle_keyval_t* kv, void* d);
PlatformResult JsonToBundle(const picojson::object& json, bundle* bundle_data);
+PlatformResult BundleToJson(bundle* bundle_data, picojson::object* json);
PlatformResult JsonToBundle(const picojson::array& json, bundle* bundle_data);
} // namespace common;