MVC 6 中的 @Json.Encode 或 @Json.Decode 方法在哪里? [英] Where are @Json.Encode or @Json.Decode methods in MVC 6?

查看:16
本文介绍了MVC 6 中的 @Json.Encode 或 @Json.Decode 方法在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MVC6 中的 MVC5 的 @Json.Encode 方法等价于什么?在 MVC5 中,我们可以在视图中访问这些方法.但我找不到任何可以从 MVC 6 视图访问的方法.

What is equivalent of MVC5's @Json.Encode method in MVC6? In MVC5 we can access those methods in views. But I can't find any methods which I can access from MVC 6 views.

如果 MVC6 中已经有内置功能,我不想编写辅助方法.

I don't want to write a helper method if there is already a built in feature in MVC6.

推荐答案

经过一番搜索,找到了:

After some search, found it:

@inject IJsonHelper Json;
@Json.Serialize(...)

这篇关于MVC 6 中的 @Json.Encode 或 @Json.Decode 方法在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆