Skip to main content

Timeline for Extracting information from JSON

Current License: CC BY-SA 4.0

17 events
when toggle format what by license comment
Oct 14, 2018 at 15:07 answer added user73941 timeline score: 1
Oct 12, 2018 at 6:03 comment added Mast @t3chb0t I read it like the JSON is anonymized. It makes it a little harder, but it's necessary at times and not a violation of the rules as long as there's no (other) obfuscation going on.
Oct 11, 2018 at 20:11 answer added Pieter Witvoet timeline score: 4
Oct 11, 2018 at 18:10 review Close votes
Oct 12, 2018 at 8:26
Oct 11, 2018 at 17:52 comment added t3chb0t Could you tell something more about this part: I need a dynamic approach. I do not want to create C# classes for the JSON data. - why does it have to be dynamic? What are using this for?
Oct 11, 2018 at 17:49 comment added t3chb0t Here is a simplified version of my JSON - what do you mean by simplified? Have you removed any properties from it or made the structure simpler? Usually we don't like anything simplified...
Oct 11, 2018 at 15:33 comment added Xiaoy312 @PieterWitvoet You're right. The example in the initial post looked like it was a simple distinct by name.
Oct 11, 2018 at 15:17 comment added Pieter Witvoet @Xiaoy312: that only compares categories by name, which isn't sufficient. Replacing that GroupBy part with Distinct(JToken.EqualityComparer) should make it work as intended.
Oct 11, 2018 at 15:10 comment added Xiaoy312 You can simplify the code down to: string.Join("\n", JObject.Parse(jString)["Relations"].SelectMany(x => x["Categories"]).GroupBy(x => (string)x["Name"], (k, g) => g.First()))
Oct 11, 2018 at 14:51 history edited Michael Haddad CC BY-SA 4.0
deleted 103 characters in body
Oct 11, 2018 at 14:50 comment added Michael Haddad @PieterWitvoet - Well, I believe I had a great reason in my head for creating result, but after working for 10 straight hours, I believe I was just confused :). I will delete it from the question. I will edit the question to answer the other questions. Thanks for the notes!
Oct 11, 2018 at 14:44 comment added Pieter Witvoet Why do you create a second list (result) that ends up being a copy of the first (categories)? How is this code meant to be used (since it doesn't return anything)? And how important is input validation (e.g. do you need JToken.DeepEquals or is it safe to use (string)category.Name for comparisons)?
Oct 11, 2018 at 14:18 history edited Michael Haddad CC BY-SA 4.0
added 64 characters in body
Oct 11, 2018 at 14:17 comment added Michael Haddad @IEatBagels - Ignore my last comment. Yes, it should be JSON. But I will edit the question to be clearer.
Oct 11, 2018 at 14:12 comment added IEatBagels Is it necessary that your result is in JSON? Couldn't you want a list of categories without json? Like : ["Identity","Contact Information",...]
Oct 11, 2018 at 14:09 answer added CWallach timeline score: -1
Oct 11, 2018 at 13:51 history asked Michael Haddad CC BY-SA 4.0