We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here is some example code to reproduce the issue:
from json_converter.json_mapper import JsonMapper from json_converter.json_mapper import json_object, json_array from json_converter.post_process import prefix_with, concatenate_list from json_converter.post_process import default_to import json exampleJson = { "STUDY_SET": { "STUDY": { "IDENTIFIERS": { "EXTERNAL_ID": [ { "@namespace": "BioProject", "@label": "primary", "#text": "PRJNA269149" }, { "@namespace": "GEO", "#text": "GSE63817" } ] }, "STUDY_LINKS": { "STUDY_LINK": { "XREF_LINK": { "DB": "pubmed", "ID": "26495981" } } } } } } specs = { '$on' : 'STUDY_SET.STUDY', 'schema:identifier' : ['$array', [ { '$on' : 'IDENTIFIERS.EXTERNAL_ID', '@type': ['', default_to, 'PropertyValue'], 'schema:propertyID': ['', default_to, 'external_id'], 'schema:value': ['#text'], 'schema:valueReference' : ['@namespace'] }, { '@type': ['', default_to, 'PropertyValue'], 'schema:propertyID': ['STUDY_LINKS.STUDY_LINK.XREF_LINK.DB'], 'schema:value': ['STUDY_LINKS.STUDY_LINK.XREF_LINK.ID'] }, ], True], # Keep this True for array mapping } transformedJSON = JsonMapper(exampleJson).map(specs) print(json.dumps(transformedJSON, indent=4))
This is what I would expect it to output:
{ "schema:identifier": [ { "@type": "PropertyValue", "schema:propertyID": "external_id", "schema:value": "PRJNA269149", "schema:valueReference": "BioProject" }, { "@type": "PropertyValue", "schema:propertyID": "external_id", "schema:value": "GSE63817", "schema:valueReference": "GEO" }, { "@type": "PropertyValue", "schema:propertyID": "pubmed", "schema:value": "26495981" } ] }
However it outputs with missing variables and values:
{ "schema:identifier": [ { "@type": "PropertyValue", "schema:propertyID": "external_id" }, { "@type": "PropertyValue", "schema:propertyID": "pubmed", "schema:value": "26495981" } ] }
I've tried a few alternative specs, but they either crash, or produce even more undesirable outputs.
Thanks in advanced for looking into this!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Here is some example code to reproduce the issue:
This is what I would expect it to output:
However it outputs with missing variables and values:
I've tried a few alternative specs, but they either crash, or produce even more undesirable outputs.
Thanks in advanced for looking into this!
The text was updated successfully, but these errors were encountered: