- if (json_object_get_boolean
- (json_object_object_get(o, "architecture_specific")))
- architecture_specific = 1;
- else
- architecture_specific = 0;
+ json_object_object_get_ex(o, "architecture_specific", &j);
+ arch_specific = json_object_get_boolean(j);
+
+ json_object_object_get_ex(o, "date_created", &j);
+ date_created = json_to_time(j);
+
+ json_object_object_get_ex(o, "status", &j);
+ status = json_object_get_string(j);
+
+ bpph = bpph_new(binary_package_name,
+ binary_package_version,
+ distro_arch_series_link,
+ self_link,
+ status,
+ arch_specific,
+ date_created);
+
+ return bpph;
+}
+
+static json_object *bpph_to_json(struct bpph *bpph)
+{
+ json_object *json, *time;
+
+ json = json_object_new_object();
+
+ json_object_object_add
+ (json,
+ "binary_package_name",
+ json_object_new_string(bpph->binary_package_name));
+
+ json_object_object_add
+ (json,
+ "binary_package_version",
+ json_object_new_string(bpph->binary_package_version));
+
+ json_object_object_add
+ (json,
+ "distro_arch_series_link",
+ json_object_new_string(bpph->distro_arch_series_link));