Skip to content

Instantly share code, notes, and snippets.


xjjon/JsonLoader.cs Secret

Created Apr 25, 2018
What would you like to do?
using System;
using Newtonsoft.Json;
using UnityEngine;
using Object = System.Object;
public static class JSONLoader {
public static Object LoadData(String dataPath, Type type)
TextAsset jsonText = Resources.Load<TextAsset>(dataPath);
return LoadData(jsonText, type);
public static Object LoadData(TextAsset textAsset, Type type)
Debug.Log("Loading " + textAsset + " as " + type);
Object obj = JsonConvert.DeserializeObject(textAsset.text, type);
return obj;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.