本文介绍了JsonConvert.SerializeObject在XamarinForms中始终返回{}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JsonConvert.SerializeObject似乎不适用于xamarin形式.否则我可能在这里错过了一些东西.这是我序列化一个简单对象时的输出.

JsonConvert.SerializeObject seems to be not working in xamarin forms. Or i might be missing something here. Here is the output when i serialize a simple object.

看到它返回{}.我也尝试序列化一个类,它确实返回了相同的结果.

See it returns {}. I tried serializing a class also and it did return the same.

这里可能是什么问题?

What could be the problem here?

更新

仍然没有解决此问题的方法.我尝试创建一个简单的控制台应用程序,并且serializeObject在该项目上工作,因此我认为它仅在xamarin形式下不起作用.有人在JSON.NET的serializeobject工作的地方有一个xamarin表单项目吗?

Still no solution to this issue. I tried creating a simple console application and serializeObject is working on that project so i assume it is not working in xamarin forms only. Does anybody have a xamarin forms project where JSON.NET's serializeobject is working?

我正在使用Visual Studio 2017,json.net 10.0.3和实时播放器.

I am using visual studio 2017, json.net 10.0.3 and live player.

推荐答案

我尝试在快速的计算机上设置模拟器,然后序列化工作了!因此,这意味着当我使用Android手机在实时播放器上运行它时,它不起作用.我现在将其设置为答案.如果其他人发布了如何在实时播放器上运行的信息,我会将其设置为正确答案

I tried setting up emulator on a fast machine and the serialize works! So it means it doesn't work when i run it on live player using my android phone. I will set this as an answer for now. if someone else posted on how to make it work on live player, i will set it as the correct answer

这篇关于JsonConvert.SerializeObject在XamarinForms中始终返回{}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 23:25