Closed wdduncan closed 3 years ago
You need to use biolinkml.utils.yamlutils.as_json_obj() to generate the JSON. Its job, among several things, is to remove all non-initialized types. As an example, see the section titled "and can be combined w/ the JSON-LD Context to generate RDF" in https://github.com/biolink/biolinkml/blob/master/notebooks/examples.ipynb
So, in your case:
with open('test-dump.json', 'w') as f:
json.dump(as_json_obj(n1, f))
Thanks!
This is similar to #296 but pertains to the value
None
showing up in the objects.In the nmdc schema, the class
named thing
is specified like so:If I create a simple object like so:
The
description
slot has the valueNone
:This results in null values being saved when serializing the object as json. E.g.:
produces:
Do we want remove the
null
valued slots? That is, produce the output: