简体   繁体   English

如何反序列化JSON字符串

[英]How to deserialize JSON string

I have found lots of online tutorials but all of them are deserializing JSON strings into objects or lists of objects. 我发现了很多在线教程,但是所有教程都将JSON字符串反序列化为对象或对象列表。

I just have a web service which returns either 1 or 0 as JSON. 我只有一个Web服务,它返回1或0作为JSON。

So it prints something like: 因此它打印出类似以下内容:

""\"0\""

Or: 要么:

""\"1\""

How can I deserialize a simple JSON like that into a string? 如何将像这样的简单JSON反序列化为字符串?

According to the RFC4627 a valid JSON string is defined as either a JSON object or a JSON array. 根据RFC4627 ,有效的JSON字符串定义为JSON对象或JSON数组。 Your web service should return something similar to this. 您的Web服务应返回类似于此的内容。

{ "Result": 0 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM