Skip to content

Support custom jsonSerializer #8

Description

@bajtos

See strongloop/loopback#1650 (comment)

// a custom JSON serializer function for producing JSON response bodies// @param sanitizedData: response data containing only safe properties// @param originalError: the original Error object
jsonSerializer: function(sanitizedData,originalError){if(originalError.name==='ValidationError'){vardetails=sanitizedData.details||{};sanitizedData.issueCount=details.codes&&Object.keys(details.codes).length;}returnsanitizedData;}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions