Files
Proftaak-RH-B4/RH-Engine/JSONParser.cs
Sem van der Hoeven 5699f8678e json parser stuff
2020-09-16 12:14:04 +02:00

33 lines
795 B
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace RH_Engine
{
class JSONParser
{
/// <summary>
/// parses the given response from the server into strings
/// </summary>
/// <param name="msg">the message gotten from the server, without the length prefix</param>
/// <returns></returns>
public static string[] Parse(string msg)
{
dynamic jsonData = JsonConvert.DeserializeObject(msg);
Newtonsoft.Json.Linq.JArray data = jsonData.data;
foreach (dynamic d in data)
{
Console.WriteLine(d.clientinfo.host);
}
return null;
}
}
}