带空格的JSON值
我在Unity上开发并使用SimpleJSON库读取JSON。因此,我做了以下工作:带空格的JSON值,json,unity3d,Json,Unity3d,我在Unity上开发并使用SimpleJSON库读取JSON。因此,我做了以下工作: JSONNode datos = JSON.Parse (jsonString); for (int i = 0; i < datos["posts"].Count; i++) { string aux = datos ["posts"] [i] ["text"]; } 我看到两种可能的情况: 最可能的情况是,http服务器的响应已经在JSON字符串中删除了空格,或者您在解析之前将其删除了
JSONNode datos = JSON.Parse (jsonString);
for (int i = 0; i < datos["posts"].Count; i++) {
string aux = datos ["posts"] [i] ["text"];
}
我看到两种可能的情况:
string aux = datos.AsObject ["posts"].AsArray [i].AsObject ["text"].Value;
还要尝试解析到JSONObject:
JSONObject datos = JSON.Parse (jsonString).AsObject;
我认为这不是图书馆的问题。您能否提供更相关的代码-如何检索
jsonString
变量?unity
是错误的标记。也许你的意思是unity3d
?我每天都使用SimpleJSON,它不会删除空格。在解析之前,需要对字符串进行一些处理。
JSONObject datos = JSON.Parse (jsonString).AsObject;