jq: how to query for array values that don’t contain text “foo”?
You can use not to reverse the logic (.imageTags[] | contains(\”latest\”) | not) Also, I’d imagine you can simplify your pipeline into a single jq call.
You can use not to reverse the logic (.imageTags[] | contains(\”latest\”) | not) Also, I’d imagine you can simplify your pipeline into a single jq call.
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
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
It was because of the trailing comma after the last nested list [ “city”, null, {} ]. I accidentally left it in and JSON doesn’t allow them.
Is this causing a problem or are you just curious? I had the same issue when I was sending data as the type “object” inside another a container class. The container itself was being deserialized properly but the object inside wasn’t. I thought it wasn’t deserializing it because of the double curly braces. In reality, … Read more
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
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
So it turned out that, the value of request body is not passed in because I need to have the @RequestBody annotation not only in my interface, but in the actual method implementation. Once I have that, the problem is solved.
This is a matter of opinion, which is not the kind of Question that Stackoverflow loves to see. in any case, I will offer mine. You are returning the representation of the state of an object or resource. The ID is part of that representation, and therefore ought to be included in the JSON packet. … Read more