jq: how to filter an array of objects based on values in an inner array?

Very close! In your select expression, you have to use a pipe (|) before contains. This filter produces the expected output. . – map(select(.Names[] | contains (“data”))) | .[] .Id The jq Cookbook has an example of the syntax. Filter objects based on the contents of a key E.g., I only want objects whose genre … Read more

Finding the max value of a property in an array of objects

To find the maximum y value of the objects in array: Math.max.apply(Math, array.map(function(o) { return o.y; })) or in more modern JavaScript: Math.max(…array.map(o => o.y)) Warning: This method is not advisable, it is better to use reduce. With a large array, Math.max will be called with a large number of arguments, which can cause stack … Read more

Using JSON to Serialize/Deserialize TimeSpan

I tried #Jessycormier’s method and it didn’t work for me. I ran DataContractJsonSerializer to see what it would generate and I found that gave me a value that looked more like this. {“PassedTimeSpan”:”P1DT2H3M4S”} The value shown above was for 1 day, 2 hours, 3 minutes, and 4 seconds. So it looks like format is: [-]P[{days}D][T[{hours}H][{min}M][{sec}S]] … Read more

Custom conversion of specific objects in JSON.NET

If anyone’s interested in my solution: When serializing certain collections, I wanted to create an associative json array instead of a standard json array, so my colleague client side developer can reach those fields efficiently, using their name (or key for that matter) instead of iterating through them. consider the following: public class ResponseContext { … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)