Editor’s note
When editors want to load unity
private string getjson()
{
String result;
Uri uri = new Uri(string.Format("http://localhost:8080/rest/scene"));
HttpWebRequest request = HttpWebRequest.Create(uri) as HttpWebRequest;
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
result = reader.ReadToEnd();
}
Debug.Log("[json]:" + result);
return result;
}
private SceneEntity[] JsonToEntity(string json)
{
json = "{\"Items\":" + json + "}";
Debug.Log("[json]:" + json);
SceneEntity[] scenes = JsonHelper.FromJson<SceneEntity>(json);
foreach (SceneEntity entity in scenes)
{
Debug.Log("[scene][id]:" + entity.id + " [name]:" + entity.name);
}
Debug.Log ("[0][id]:" + scenes[0].id);
Debug.Log ("[1][id]:" + scenes[1].id);
return scenes;
}
Similar Posts:
- [Solved] HttpClient HttpRequestHeaders.From Error: The specified value is not a valid ‘From’ header string.
- How to deal with the problem of failed to execute ‘send’ on ‘XMLHttpRequest’: failed to load ‘URL’
- [Solved] Cannot call sendRedirect() after the response has been committed
- [Solved] Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
- Solve the problem of “resource interpreted as document but transferred with MIME type application / JSON” in IE browser
- [Solved] Json.Net – Error getting value from ‘ScopeId’ on ‘System.Net.IPAddress’
- Android Exception: UncaughtException detected: java.lang.RuntimeException: Parcelable encountered IOExcepti
- [Solved] Json.Net Error: Error getting value from ‘ScopeId’ on ‘System.Net.IPAddress’
- java.lang.IllegalStateException: Failed to load property source from location ‘classpath:/application-dev.yml’
- [Solved] react native TypeError: Network request failed Unable to symbolicate stack trace: The stack is null