LitJSON HelloWorld Sampe

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;

public static class Program
{
	public static void Main()
	{			
		// Serialize JSON to object
		var fromJson = "[{\"BattleCfg\":\"10_03_001\",\"SceneName\":\"RoomBall\",\"Item1\":\"1\",\"Prev\":\"0\",\"Item2\":\"2\",\"Next\":\"2\",\"Hp\":\"8\",\"Item3\":\"3\",\"Id\":\"1\",\"Name\":\"01\"}]";
		var fromObject = LitJson.JsonMapper.ToObject<List<Dictionary<string, string>>>(fromJson);	
		foreach(var dictionary in fromObject)
		{
			foreach(var kv in dictionary)
			{
				Console.WriteLine(kv);
			}
		}
	}
}
;