Alisa
Alisa
CC#
Created by Alisa on 7/24/2023 in #help
❔ Need advice on how to structure a repository
Hello! I'm making a program that will interact with data in a json file, so I'm making a class to represent that. The methods that are going to be in the class are: * Register() — will create the json file if it doesn't already exist * Write() — will overwrite the contents of the file with new contents * Read() — will read the file and return the string json that it contains Any suggestions on this? My immediate concern is whether I should be deriving some interface or interfaces, rather than doing it raw like I'm intending to so far
5 replies
CC#
Created by Alisa on 4/26/2023 in #help
✅ getting all the keys of a json object
The json input I have is:
{
"vacuum": [],
"dust": []
}
{
"vacuum": [],
"dust": []
}
What I want as output is:
vacuum
dust
vacuum
dust
The json is contained in a JsonObject, and I'm trying to make a method to do what I'm talking about:
public void List()
{
foreach (var key in jsonObj)
{
Console.WriteLine(key);
}
}
public void List()
{
foreach (var key in jsonObj)
{
Console.WriteLine(key);
}
}
But the output I'm getting is:
[vacuum, []]
[dust, []]
[vacuum, []]
[dust, []]
76 replies