aboutsummaryrefslogtreecommitdiff
path: root/src/json/json_generator.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/json/json_generator.c')
-rw-r--r--src/json/json_generator.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/json/json_generator.c b/src/json/json_generator.c
index d8c82bc86..96f07bdc2 100644
--- a/src/json/json_generator.c
+++ b/src/json/json_generator.c
@@ -182,12 +182,32 @@ GNUNET_JSON_from_gns_record (const char* rname,
182 record_type_str = GNUNET_GNSRECORD_number_to_typename(rd->record_type); 182 record_type_str = GNUNET_GNSRECORD_number_to_typename(rd->record_type);
183 183
184 // ? for possible NULL values 184 // ? for possible NULL values
185 ret = json_pack("{s:s?,s:s?,s:s?,s:i,s:s?}", 185 if (NULL != rname)
186 "value", value_str, 186 {
187 "type", record_type_str, 187 ret = json_pack ("{s:s?,s:s?,s:s?,s:i,s:s?}",
188 "expiration_time", expiration_time_str, 188 "value",
189 "flag", flags, 189 value_str,
190 "label", rname); 190 "record_type",
191 record_type_str,
192 "expiration_time",
193 expiration_time_str,
194 "flag",
195 flags,
196 "record_name",
197 rname);
198 }
199 else
200 {
201 ret = json_pack ("{s:s?,s:s?,s:s?,s:i}",
202 "value",
203 value_str,
204 "record_type",
205 record_type_str,
206 "expiration_time",
207 expiration_time_str,
208 "flag",
209 flags);
210 }
191 GNUNET_free_non_null(value_str); 211 GNUNET_free_non_null(value_str);
192 return ret; 212 return ret;
193} 213}