decodeJson function
Implementation
Future<Object?> decodeJson(Request request) async {
final content = await request.readAsString();
try {
final Object? value = jsonDecode(content);
return value;
} on FormatException catch (e, stackTrace) {
throw BadRequestException(
400,
'Could not parse the request body as JSON.',
innerError: e,
innerStack: stackTrace,
);
}
}