sunder.cc
sunder.cc
CC#
Created by Malibloo on 12/30/2022 in #help
❔ JSON Serialization Weird Model
gives you a nice model and multiple options to make it whatever you want
49 replies
CC#
Created by Malibloo on 12/30/2022 in #help
❔ JSON Serialization Weird Model
also you can easily whip up classes with websites like json2csharp
49 replies
CC#
Created by Malibloo on 12/30/2022 in #help
❔ JSON Serialization Weird Model
i wouldnt suggest using Object as a class name since it collides with System.object
49 replies
CC#
Created by Brady Kelly on 12/12/2022 in #help
❔ How can I query a JSON doc for only objects with a specific property value?
Model is a class with whatever properties you want
13 replies
CC#
Created by Brady Kelly on 12/12/2022 in #help
❔ How can I query a JSON doc for only objects with a specific property value?
which is most likely slower then just deserializing
13 replies
CC#
Created by Brady Kelly on 12/12/2022 in #help
❔ How can I query a JSON doc for only objects with a specific property value?
var items = JsonSerializer
.Deserialize<JsonElement>("json goes here")
.GetProperty("pagedata")
.EnumerateArray()
.Where(element => element.GetProperty("id").GetString() == "settings_tab_5")
.Select(element => element.Deserialize<Model>());
var items = JsonSerializer
.Deserialize<JsonElement>("json goes here")
.GetProperty("pagedata")
.EnumerateArray()
.Where(element => element.GetProperty("id").GetString() == "settings_tab_5")
.Select(element => element.Deserialize<Model>());
13 replies
CC#
Created by Brady Kelly on 12/12/2022 in #help
❔ How can I query a JSON doc for only objects with a specific property value?
if you want to filter it before deserializing you could do something like this
13 replies
CC#
Created by Brady Kelly on 12/12/2022 in #help
❔ How can I query a JSON doc for only objects with a specific property value?
deserializing the whole thing would probably the simplest and probably even the fastest
13 replies
CC#
Created by Pdawg on 11/28/2022 in #help
❔ Adding logic into a JSON serializer
So if you can do it before serializing it would be the best
11 replies
CC#
Created by Pdawg on 11/28/2022 in #help
❔ Adding logic into a JSON serializer
Youll have to deserialize it, add it and then serialize it again
11 replies
CC#
Created by Pdawg on 11/28/2022 in #help
❔ Adding logic into a JSON serializer
Adding content after it being serialized is quite hard
11 replies
CC#
Created by Pdawg on 11/28/2022 in #help
❔ Adding logic into a JSON serializer
Yes
11 replies
CC#
Created by Pdawg on 11/28/2022 in #help
❔ Adding logic into a JSON serializer
you could create the Dictionary before that and use that dictionary for the Icons or you can add a loop after assigning the Dictionary and add items to
model.Icons
model.Icons
11 replies
CC#
Created by Hugh on 11/27/2022 in #help
Comparing types when using reflection
@Hugh not enterily sure what youre exactly doing but the Type class has a GetCustomAttribute method which you can use like this:
method.GetType().GetCustomAttribute<MyAttribute>();
method.GetType().GetCustomAttribute<MyAttribute>();
10 replies
CC#
Created by reeeeeee on 10/4/2022 in #help
Get multiple objects in JObject path
the json youve send was a bit malformed but a JToken is an ienumerable and you can simply .ToList() it
var token= JObject.Parse(json)["cust_toLegalEntity"];
var tokenList= token.ToList();
var token= JObject.Parse(json)["cust_toLegalEntity"];
var tokenList= token.ToList();
9 replies
CC#
Created by Kekke on 10/3/2022 in #help
How do I split these strings?
If you can't change it then there's not really a reliable method that I'm aware of to split it
51 replies
CC#
Created by Kekke on 10/3/2022 in #help
How do I split these strings?
Then you can use the split function
51 replies
CC#
Created by Kekke on 10/3/2022 in #help
How do I split these strings?
If you can change the separator i would change it to something like &
51 replies