问题描述
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.
这可能是什么问题?
更新
仍然没有解决这个问题.我尝试创建一个简单的控制台应用程序,并且 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.
推荐答案
我尝试在一台快速机器上设置模拟器并且序列化工作!所以这意味着当我使用我的安卓手机在现场播放器上运行它时它不起作用.我现在将其设置为答案.如果其他人发布了如何使其在现场播放器上运行,我会将其设置为正确答案
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 中总是返回 {}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!