|
|
(同じ利用者による、間の23版が非表示) |
行1: |
行1: |
− | ==jsonを扱うには==
| + | [[Unity/Csharp/Json/JsonUtility]] |
− | Unity 5.3からJsonUtilityが使えるようになったので、JsonUtilityを使った | + | |
| | | |
− | ==json展開==
| + | [[Unity/Csharp/Json/NewtonJson]] |
− | public class AuthScript : MonoBehaviour {
| + | |
− | class ResData {
| + | |
− | public string status = "ok";
| + | |
− | public string notice = "";
| + | |
− | public string user;
| + | |
− | }
| + | |
− | class ResUser {
| + | |
− | public int id = 0;
| + | |
− | public string name = "";
| + | |
− | }
| + | |
− | void ExecJsonParse (string json) {
| + | |
− | ResData resData = JsonUtility.FromJson<ResData>(json);
| + | |
− | Debug.Log("status=" + resData.status);
| + | |
− | Debug.Log("notice=" + resData.notice);
| + | |
− | }
| + | |
− | }
| + | |
− | | + | |
− | ==公式JsonUtility==
| + | |
− | https://docs.unity3d.com/ScriptReference/JsonUtility.html
| + | |
2021年7月5日 (月) 15:32時点における最新版
Unity/Csharp/Json/JsonUtility
Unity/Csharp/Json/NewtonJson