-
Anonymous
Как я могу распечатать как ключ, так и значения, используя minijson в unity3d
Сообщение
Anonymous »
Я использую minijson для получения значений из json в unity3d
Ответ
Код: Выделить всё
{"existing":[{"LastUpdated":"7\/9\/2013 4:03:57 AM","LetterSpeed":100,"Letters":"SP","NumRandom":5,"Reward":10,"ShowWordDesc":false,"ShowWordHint":false,"Sort_ID":5,"WN_Level_ID":34,"WN_Word_ID":95,"WordDesc":"","WordHint":"","zError":null},{"LastUpdated":"7\/9\/2013 4:03:57 AM","LetterSpeed":100,"Letters":"aún","NumRandom":2,"Reward":10,"ShowWordDesc":true,"ShowWordHint":false,"Sort_ID":10,"WN_Level_ID":34,"WN_Word_ID":83,"WordDesc":"still","WordHint":"","zError":null},{"LastUpdated":"7\/9\/2013 4:03:58 AM","LetterSpeed":200,"Letters":"tanto","NumRandom":3,"Reward":10,"ShowWordDesc":true,"ShowWordHint":false,"Sort_ID":20,"WN_Level_ID":34,"WN_Word_ID":84,"WordDesc":"so","WordHint":"","zError":null}]}
Я использовал код
Код: Выделить всё
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using MiniJSON;
В функции
Код: Выделить всё
string response = www.text;
Debug.Log(response);
IDictionary search = (IDictionary) Json.Deserialize(response);
IList tweets = (IList) search["existing"];
foreach (IDictionary tweet in tweets) {
Debug.Log(tweet["LastUpdated"]);
}
Если я не знаю имени ключа, как я могу сохранить и ключи, и значение?
Подробнее здесь:
https://stackoverflow.com/questions/182 ... in-unity3d
1731014168
Anonymous
Я использую minijson для получения значений из json в unity3d
Ответ
[code]{"existing":[{"LastUpdated":"7\/9\/2013 4:03:57 AM","LetterSpeed":100,"Letters":"SP","NumRandom":5,"Reward":10,"ShowWordDesc":false,"ShowWordHint":false,"Sort_ID":5,"WN_Level_ID":34,"WN_Word_ID":95,"WordDesc":"","WordHint":"","zError":null},{"LastUpdated":"7\/9\/2013 4:03:57 AM","LetterSpeed":100,"Letters":"aún","NumRandom":2,"Reward":10,"ShowWordDesc":true,"ShowWordHint":false,"Sort_ID":10,"WN_Level_ID":34,"WN_Word_ID":83,"WordDesc":"still","WordHint":"","zError":null},{"LastUpdated":"7\/9\/2013 4:03:58 AM","LetterSpeed":200,"Letters":"tanto","NumRandom":3,"Reward":10,"ShowWordDesc":true,"ShowWordHint":false,"Sort_ID":20,"WN_Level_ID":34,"WN_Word_ID":84,"WordDesc":"so","WordHint":"","zError":null}]}
[/code]
Я использовал код
[code]using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using MiniJSON;
[/code]
В функции
[code]string response = www.text;
Debug.Log(response);
IDictionary search = (IDictionary) Json.Deserialize(response);
IList tweets = (IList) search["existing"];
foreach (IDictionary tweet in tweets) {
Debug.Log(tweet["LastUpdated"]);
}
[/code]
Если я не знаю имени ключа, как я могу сохранить и ключи, и значение?
Подробнее здесь: [url]https://stackoverflow.com/questions/18223700/how-can-i-print-both-key-and-values-using-minijson-in-unity3d[/url]