title: Parse JSON Data from server
body: <p>I know that there are many thread talking about parsing json data but the json data that I get from my server is not common.</p>
  
  <p>So I have a c# script in unity that get json data from my node.js server using websocket.</p>
  
  <p>This my code in unity :</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  using System;
  using System.Threading;
  using WebSocketSharp;
  
  
  [Serializable]
  public class ParamJSON
  {
      public string parameter;
      public string unit;
      public int count;
      public float value;
      public Time time;
  }
  
  public class Program : MonoBehaviour
  {
      string waka;
      ParamJSON data;
      WebSocket ws;
  
      // Use this for initialization
      void Start()
      {
          ws = new WebSocket(url of server);
          print("Open socket: " + ws.ReadyState);
          print("Websocket Alive: " + ws.IsAlive);
  
  
           ws.OnMessage += (sender, e) =&gt;
          {
              waka = e.Data;
              print(waka);
              //ParamJSON[] obj = JsonHelper.getJsonArray&lt;ParamJSON&gt;(waka);
              //print(obj);
  
              //ParamJSON P = JsonUtility.FromJson&lt;ParamJSON&gt;(waka);
              //Debug.Log(P.parameter);
  
              //data = CreateFromJSON(waka);
              //Debug.Log(data);
              //Debug.Log("parameter = " + data.parameter);
  
              //print("JSON data : " + CreateFromJSON(waka));
  
          };
  
  
  
          ws.OnOpen += (sender, e) =&gt; {
              print("WebSocket-&gt; Open:");
              print("Open socket-&gt; OnOpen: " + ws.ReadyState);
          };
  
  
          ws.OnError += (sender, e) =&gt; {
              print("WebSocket-&gt; Error: " + e.Message);
              print("Open socket-&gt; OnError: " + ws.ReadyState);
          };
  
  
          ws.OnClose += (sender, e) =&gt; {
              print("WebSocket-&gt; Close-code: " + e.Code);
              print("WebSocket-&gt; Close-reason: " + e.Reason);
              print("Open socket-&gt; OnClose: " + ws.ReadyState);
          };
  
          ws.Connect();
      }
  
  
      public class JsonHelper
      {
          public static T[] getJsonArray&lt;T&gt;(string json)
          {
              string newJson = "{ \"array\": " + json + "}";
              Wrapper&lt;T&gt; wrapper = JsonUtility.FromJson&lt;Wrapper&lt;T&gt;&gt;(newJson);
              return wrapper.array;
          }
  
          [Serializable]
          private class Wrapper&lt;T&gt;
          {
              public T[] array;
          }
      }
  
      //public static ParamJSON CreateFromJSON(string jsonString)
      //{
      //    return JsonUtility.FromJson&lt;ParamJSON&gt;(jsonString);
      //}
  
  
  
      // Update is called once per frame
      void Update()
      {
  
      }
  
  
      void OnDestroy()
      {
          if (ws != null &amp;&amp; ws.ReadyState == WebSocketState.Open)
              ws.Close();
      }
  
  }
  </code></pre>
  
  <p>The output from the console is : 42["P0","{\"unit\":\"hPA\",\"time\":\"11:18:06.836736\",\"count\":7,\"parameter\":\"P0\",\"value\":1021.799988}"]</p>
  
  <p>So I woud like to know how can I parse this json data ?
  If it's possible to have something like (in my console):</p>
  
  <p>unit: hPA</p>
  
  <p>time: 11:18:06.836736</p>
  
  <p>count: 7</p>
  
  <p>etc...</p>
  
  <p>All the line in comment is all that I have already tried to do.</p>
  
  <p>Thank you !</p>