I am displaying data queried from mongodb in a table, and then using the JSON explorer to show additional data for a selected row. Such as:
I would like to return regular JSON without the $numberDecimal.
Is there a way to do this using the transformer?
Hey @shira!
This certainly looks like something that can be done with a transformer, for instance, instead of passing {{ record }}
you could do something like {{ {...record, chain_id: record.chain_id.$numberDecimal} }}
. In your case you might want to replace record
with yourTable.selectedRow.data
but you can also add a transformer to your MongoDB query that does something like:
return data.map(record => ({...record, chain_id: record.chain_id.$numberDecimal})
You can add additional fields as well that you'd like to parse but if you're parsing a lot of fields or those fields have different structures you might want a different syntax.
Let me know if that helps!