如何显示“粘贴 Json 类"在 Visual Studio 2012 中单击选择性粘贴时? [英] How to show the "paste Json class" in visual studio 2012 when clicking on Paste Special?

查看:18
本文介绍了如何显示“粘贴 Json 类"在 Visual Studio 2012 中单击选择性粘贴时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 vs 2012 中过去的特殊功能,以便为我的 Json 数据生成 c# 类.我从 Nuget 的 NewtonSoft 下载了 Json.New,然后添加了一个新的 .cs 类,将我的 json 数据复制到剪贴板,但是当我转到 Edit-> Paste Special --> 我只能看到:Paste XML As Classes only the PasteJson 作为类功能未显示.有什么建议?提前谢谢你

I am trying to use the past special feature in vs 2012 in order to generate c# class for my Json data. I downloaded the Json.New from NewtonSoft from Nuget and then added a new .cs class the copied my json data to clipboard but when I go to Edit-> Paste Special --> I can only see: Paste XML As Classes only the Paste Json as Classes feature is not showing. Any Suggestions? Thanks you in advance

这是我得到的,请注意我已经安装了 Newtonsoft.Json:

This is what I am getting and please note that I have installed Newtonsoft.Json already:


(来源:indevcogroup.com)

推荐答案

我创建了一个新项目,安装了 Newtonsoft.Json 并添加了一个类.

I created a new project, installed Newtonsoft.Json and added a class.

如果您打开了类文件,请复制您的 Json 数据并选择编辑 -> 选择性粘贴,您将看到两个选项:

If you have your class file open, copy your Json data and choose Edit -> Paste Special you will see both the options:

如果您打开了其他类型的文件(例如 app.config),您只会看到将 JSON 粘贴为类"(并且它是灰色的)

If you have some other kind of file open (e.g. app.config), you only see "Paste JSON as As Classes" (and it's greyed out)

不过,它看起来确实有点不稳定 - 有时我必须重新复制数据才能显示出来.

It does seem a bit flaky though - sometimes I had to recopy the data before it would show up.

尝试 a) 重新复制您的数据 b) 玩弄您打开的窗口 c) 重新安装扩展程序

Try a) recopying your data b) playing around with what windows you've got open c) reinstalling the extension

这篇关于如何显示“粘贴 Json 类"在 Visual Studio 2012 中单击选择性粘贴时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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