如何将.DOT文件转换为JSON FORMATFILE。 [英] How to convert .DOT files to JSON FORMATFILE.?

查看:200
本文介绍了如何将.DOT文件转换为JSON FORMATFILE。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我获得了扩展名为.dot文件的扫描数据,我希望使用.net application.can将其转换为json格式文件任何人都建议我如何我能做到。



我尝试过的事情:



i尝试在谷歌转换.dot文件到json,我有几个链接。但我没有得到确切的解决方案。

Hi ,

I got scan data with extension of .dot files ,i want convert this to json format file using .net application.can anybody suggest me how i can do, please.

What I have tried:

i tried in google convert .dot file to json ,i got couple of links.but i didn't get exact solution.

推荐答案

一个.dot文件是没有明显的原因是图形描述语言中包含数据的文件不太受欢迎的原因 DOT(图形描述语言) - 维基百科 [ ^ ]



所以首先你必须学习读取它的编码,我首先尝试UTF8,假定默认为.dot文件 DOT语言 [<啊ref =http://www.graphviz.org/doc/info/lang.htmltarget =_ blanktitle =New Window> ^ ]



接下来你创建一个类,它遵循最新链接的模式,然后为.dot文件创建一个解析器并挖掘数据来填充你的类,最后你只需使用选择的Json序列化器来生成JSON。

首先尝试默认(System.Web.Extensions),如果它不通过nuget选择Newtonsoft.JSON,因为它有更好的方法来进行自定义序列化。



只是为了击败可能的直接问题......那么有没有办法做到这一点,而不是从口袋里掏出一些东西,只是新手上别人做的东西? (除了令人讨厌的问题,对于那个问题)答案似乎是否定的,不是.net请记住,两种格式之间的一个重要区别是.dot og .gv文件具有上下文特定格式,其中json更多对象表示的约定所以这两种格式本身并不是可交换的,尽管json文档的某些特定实例(遵循DOT文件的规范)可以是。
A .dot file is for no apparent reason the less favoured extension of a file containing data in the Graph description language DOT (graph description language) - Wikipedia[^]

So first you have to learn what encoding to read it with, i'd try UTF8 first which is presumed default in .dot files The DOT Language[^]

Next up you make a class Which adheres to the schema of the most resent link and then make a parser for the .dot file and excavate data to populate your class, finally you simply use the Json serializer of choise to generate json.
Try default first (System.Web.Extensions) and if it doesn't opt for Newtonsoft.JSON via nuget as it has a much nicer to work with way of making custom serialization.

And just to beat the possible immediate question ... "so is there a way to do this without getting ones hands out of the pockets and just new up something somebody else did ?" (beyond the geeky WHY question to that question) the answer appears to be NO, not for .net keep in mind that an important difference between the two formats is that .dot og .gv files have a contextual specific format where as json is more of a convention for object representation so the two formats are not inherently exchangeable although some specific instance of a json document (adhearing to specs of DOT files) can be.


这篇关于如何将.DOT文件转换为JSON FORMATFILE。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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