Mattias Wadman

Results 823 comments of Mattias Wadman

Maybe you can do something like this: ```sh $ echo -n '{"status": "GREEN"}' | jq -esRr 'if . == "" then null else fromjson end | has("status") and .status !=...

👍 Yeap without -sR jq will run the filter on each input JSON it reads, ex: ```sh $ echo '' | jq . $ echo '123' | jq . 123...

Yeap maybe a bit clearer than use raw slurp :) Can also do: ```sh jq -n 'inputs // null | ...' ```

Ah yeah good catch, i've been bitten by that before. Yes also wish jq had a something like the `//` operator but only check for emptyness. Thers is `isempty` but...

Two more: ```sh jq -n 'reduce inputs as $i (null; $i) | ...' # null or last input jq -n 'first(inputs, null) | ...' ``` Ok time to do something...

> I am guessing you forgot a `.[1:][]`: > > ```shell > jq -n '[ inputs ] | .[0], .[1:][]' > ``` Ah yes i was thinking about the case...

> `input/0` is great! I wish it were possible to use it and `inputs/0` to iterate any `jq` expression, not just inputs from the input files. Sometimes I think of...

Seems similar to https://github.com/stedolan/jq/pull/2400?

Hi, I think you might be hitting the same issue as in https://github.com/stedolan/jq/issues/2051. A workaround could be something like: ```jq .project.channels |= map(select(."cVal" == "South")) ```

@rgordill for `==` i think you can do something like `... | select(. == ("a", "b", "c"))` for `!=` maybe something like `... | select([. != ("a", "b", "c")] |...