/ CometEngine / Json / JsonArray

JsonArray

Type:
CLASS

Description:
Class that represents json array data object.

Example:
using System;
using CometEngine;
using CometEngine.Json;

class main : CometBehaviour
{
	// Called before first frame
	public void Start()
	{
		JsonObject data = JsonObject.FileToJson(App.dataAssetsPath + "Game.json");
		if (data != null)
		{
			JsonArray players = data.GetArray("players");
			for(uint i=0; i < players.GetSize(); i++)
			{
				JsonObject player = players.GetObject(i);
				print(player.GetString("name", "empty"));
				print(player.GetInt("id", -1));
			}
		}
		data.Free();
	}

	// Called Every Frame
	public void Update()
	{
	}
}
JsonArray.cs