allenai / mmda

multimodal document analysis
Apache License 2.0
158 stars 18 forks source link

cleanup JSON conversion for all data types #164

Open kyleclo opened 2 years ago

kyleclo commented 2 years ago

Noticed JSON serialization had inconsistent behavior across various data types, especially in cases where certain fields were empty or None.

This PR adds a set of comprehensive tests in tests/test_types/test_json_conversion.py that documents these behaviors. PR also includes resolving inconsistencies. For example, now Metadata that's attached to a SpanGroup or BoxGroup won't get accidentally serialized as an empty dictionary.