VB.NET将DataTable转换为JSON的问题 [英] VB.NET problem converting DataTable to JSON

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

问题描述

好的,所以我试图使用JavaScriptSerializer与 这个 一起使用码。但是当它到达最后一行时它会崩溃;

Ok so I'm trying to use the JavaScriptSerializer to work with this code. However it crashes when it reaches the last line;

Dim json As New String(sr.Serialize(dt))

我收到此错误消息;


在序列化
'System.Reflection.Module'的对象时,检测到一个循环引用

A circular reference was detected while serializing an object of type 'System.Reflection.Module'.


$ b $


I would really appreciate any insights that could help solve this problem.

推荐答案

循环引用意味着串行化对象将会导致无限循环。
例如,如果您尝试将对象A序列化为对象B的1到1引用。

Circular reference means that serialising the object would result in an infinite loop. For example if you would try to serialize object "A" having a 1 to 1 reference to object "B".

声明一个包含数据的类想使用JSON序列化以解决这个问题。

Declare a class containg the data you want to serialize with JSON to solve this issue.

这篇关于VB.NET将DataTable转换为JSON的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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