Returning a string containing valid Json with Nancy

Looks like Nancy has got a nice Response.AsJson extension method:

Get["/providers"] = _ =>
            {
                var providers = this.interactiveDiagnostics
                                    .AvailableDiagnostics
                                    .Select(p => new { p.Name, p.Description, Type = p.GetType().Name, p.GetType().Namespace, Assembly = p.GetType().Assembly.GetName().Name })
                                    .ToArray();

                return Response.AsJson(providers);
            };

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)