« first day (2146 days earlier)      last day (512 days later) » 

4:59 PM
Hello, I applied for a job where I am too collect data from a database. I have information on the API, does anyone have a website where I can get some kind of starting info on JSON?
 
@MårtenCederholm what do you want to know? JSON is just a way of formatting data, it's not specific to databases or APIs.
 
ok
I gotten a pdf that tells how the API work
the problem its in swedish :)
 
hah - can you read Swedish? :-x
 
Yes of course
 
I'm a dumb monolingual American
 
5:09 PM
The problem is I dont know where to start
If I understand correctly you collect information via HTTP requests (which I suck at)
Actually found the instruction in english
 
 
3 hours later…
7:47 PM
@MårtenCederholm What language are you using? Where are you running the code that will make the requests?
 
Im using c#. The code is in the main method right now
I don't know how parse the information into something useful
public class Variable
{
    public string code { get; set; }
    public string text { get; set; }
    public List<string> values { get; set; }
    public List<string> valueTexts { get; set; }
    public bool? time { get; set; }
}

public class RootObject
{
    public string title { get; set; }
    public List<Variable> variables { get; set; }
}
That is json2csharp.com gives me
I need to get the the strings but also whats inside the lists
Rignt now i'm justing reading it as ReadAsStringAsync
@TehShrike
 
8:20 PM
@MårtenCederholm So you have the HTTP access all taken care of already?
Yeah, parsing JSON can be a bit awkward in class-based languages
 
I think so. I have managed to get the data and put into a string.
 
@MårtenCederholm Is that a core C# function?
 
But since it's in a string I cannot to my knowledge get the info from the lists
 
You need a JSON parsing library
 
 static async void loadData()
        {
            string page = "http://api.scb.se/OV0104/v1/doris/sv/ssd/START/ME/ME0104/ME0104D/ME0104T4";
            using(HttpClient client = new HttpClient())
            using(HttpResponseMessage response = await client.GetAsync(page))
            using(HttpContent content = response.Content)
            {
                string data = await content.ReadAsStringAsync();


                if (data != null)
                {
                    Console.WriteLine(data);
I have installed Newtonsoft.Json in the Nuget packages
 
 
1 hour later…
9:34 PM
Is there any way to check "whether second row is the value I wanted in TSQL"?

Table=Department

+------------------------------------------------+
|  SupervisorId[bigint] Department[varchar(max)] |
+------------------------------------------------+
|        1       Health                          |
|        2       Finance                         |
|        1       Research                        |
|        3       Finance                         |
|        1       Finance                         |
Note : The table is simplified
 

« first day (2146 days earlier)      last day (512 days later) »