removes empty arrays from json representation

This commit is contained in:
Ronald Steinke 2018-01-10 10:18:28 +01:00
parent 3564d2043f
commit 278d25b1bb

View File

@ -128,7 +128,10 @@ class OneM2MDictSerializer(OneM2MSerializer):
if isinstance(item, OneM2MEntity):
return self.encode_resource(item, pretty, path, encoding, fields)
return item
o[k] = map(encode_list_item, v)
if len(v):
o[k] = map(encode_list_item, v)
else:
empty_keys.append(k)
else:
try:
if len(v) == 0: