Skip to content

bluebackblue/UpmJsonItem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

112 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BlueBack.JsonItem

JSON操作

  • JSONのロード、セーブ
  • 整形(Pritty/Normalize)
  • JSONをInspectorに表示

ライセンス

MIT License

依存 / 使用ライセンス等

ランタイム

エディター

サンプル

動作確認

Unity 2022.1.0b16

UPM

最新

開発

Unityへの追加方法

  • Unity起動
  • メニュー選択:「Window->Package Manager」
  • ボタン選択:「左上の+ボタン」
  • リスト選択:「Add package from git URL...」
  • 上記UPMのURLを追加「 https://github.com/~~/UPM#バージョン

Gitクライアントがインストールされている必要がある。

public struct Item
{
	public int x;
	public int yy;
	public float zzz;
};
{
	Item t_from_item = new Item(){
		x = 10,
		yy = 11,
		zzz = 123.4f,
	};
	//JsonItemにコンバート。
	BlueBack.JsonItem.JsonItem t_jsonitem = BlueBack.JsonItem.Convert.ObjectToJsonItem(t_from_item);
	//JSON文字列にコンバート。
	string t_jsonstring = t_jsonitem.ConvertToJsonString();
	UnityEngine.Debug.Log("ConvertToJsonString : " + t_jsonstring);
	//オブジェクトにコンバート。
	Item t_to_item = t_jsonitem.ConvertToObject<Item>();
	UnityEngine.Debug.Log("ConvertToObject : x = " + t_to_item.x.ToString());
	UnityEngine.Debug.Log("ConvertToObject : yy = " + t_to_item.yy.ToString());
	UnityEngine.Debug.Log("ConvertToObject : zzz = " + t_to_item.zzz.ToString());
	//JsonItemから直接取り出す。
	t_jsonitem = new BlueBack.JsonItem.JsonItem(t_jsonstring);
	UnityEngine.Debug.Log("JsonItem : x = " + t_jsonitem.GetItem("x").CastToInt32().ToString());
	UnityEngine.Debug.Log("JsonItem : yy = " + t_jsonitem.GetItem("yy").GetBoolData().ToString());
	UnityEngine.Debug.Log("JsonItem : zzz = " + t_jsonitem.GetItem("zzz").CastToSingle().ToString());
}

About

[UPM]JSON操作

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages