Extract values from JSON text field for use in "IN" statement SQL

In Azure SQL server. I have the following (non-functional) query that is attempting to use the values from a JSON array of foreign keys to find rows, using "IN". SELECT * FROM foo_table WHERE foo_table_id IN (SELECT json_ids_field FROM bar_table WHERE bar_table_id _field= 1); However this returns an error because it does not natively understand… Read More Extract values from JSON text field for use in "IN" statement SQL

Deserializing XML from String C#

I am receiving XML strings,and would like to convert these to C# objects. Just to confirm, Is it correct? This is my class : [XmlRoot("xml")] public class GenCrfeidData { [XmlAttribute("ccris_identity")] public GenCrfeidCCRIS_Identity ccris_identity { get; set; } [XmlAttribute("spga_identity")] public GenCrfeIDSPGA_Identity spga_identity { get; set; } } public class GenCrfeidCCRIS_Identity { [XmlAttribute("item")] public List<GenCrfeIDItem> item {get;… Read More Deserializing XML from String C#

Trouble deserializing a json array using newtonsoft – array returned but all elements = nothing

I am working with VS2019 in VB.net .Net Framework 4.7.2 and using Newtonsoft JSON tool. I have this JSON sample message: { "status": "ok", "items": [ { "node": { "id": 5, "name": "HUB_SLS", "type": "COMPANY", "availableForBooking": true, "device": false, "shortName": "HSLS" } }, { "node": { "id": 6, "name": "HQ1", "type": "SITE", "availableForBooking": true, "device":… Read More Trouble deserializing a json array using newtonsoft – array returned but all elements = nothing

What C# data type would you de-serialize this Json into

What kind of C# data type / List / Class would I de-serialise the following json into when the 3-character codes (ara, ces, cym, dei etc) are dynamic. Thanks! "translations":{ "ara":{"official":"مملكة هولندا","common":"هولندا"}, "ces":{"official":"Nizozemské království","common":"Nizozemsko"}, "cym":{"official":"Kingdom of the Netherlands","common":"Netherlands"}, "deu":{"official":"Niederlande","common":"Niederlande"}, "est":{"official":"Madalmaade Kuningriik","common":"Holland"} }" When I say dynamic – at run time you don’t know what they… Read More What C# data type would you de-serialize this Json into

Is there a Gson @DeserializedName equivalent to the @SerializedName annotation?

I’m able to set the @SerializedName to this_field so when I use the toJson() function it’ll use it properly. However when I’m trying to read it in via fromJson() function it’ll try to use thisField. Normally I’d create a serializer like the one below; however is there something built in that will handle this or… Read More Is there a Gson @DeserializedName equivalent to the @SerializedName annotation?

Deserialise JSON data from external api and return a leaner JSON data

I am practicing with web api. My goal is to create a Get endpoint, which receive data from an external api, then return a leaner result. external api link: https://www.themealdb.com/api/json/v1/1/search.php?f=a, The external api data looks like: { "meals": [ { "idMeal": "52768", "strMeal": "Apple Frangipan Tart", "strDrinkAlternate": null, "strCategory": "Dessert", ….. }, { "idMeal": "52893",… Read More Deserialise JSON data from external api and return a leaner JSON data