Open salmonsec opened 10 months ago
Thanks for the report. The reason %q is used internally is because the Prisma query engine stringifies JSON. However, this should obviously not happen in the marshal func for the end user. I'll look into it in the next few days.
Is this bug still open ? Because our team while they have been developing an api faced with this issue. Data have been written in postgesql and stored as json object when they fetch data from db it gives string json? marked field in schema.prisma. Could you inform me ?
Is there a particular reason for using fmt
%q
to return the inner Raw Json struct for a JSON type field?I've found that when I try to marshal a generated data type with a JSON field, I get results like this:
Where
data.data
is of type JSON, it is escaping the quotes (treating it as a string) rather than printing the JSON object. This adds an extra step of processing at the end to have a generic JSON viewer display this correctly.When MarshalJSON is replaced with a copy of the built-in functionality, it is written as expected.
Result: