thedevsaddam / gojsonq

A simple Go package for querying over JSON, YAML, XML, and CSV data.

Home Page:https://github.com/thedevsaddam/gojsonq/wiki

Repository from Github https://github.comthedevsaddam/gojsonqRepository from Github https://github.comthedevsaddam/gojsonq

Support for unselect

gboor opened this issue · comments

I have an array of JSON objects which all contain a few common keys and then a whole bunch of keys that are different. I want to select a subset of this array that drops a single common key.

The only way to do that right now is to use a select or only with all the possible keys the object can contain minus the one I want to drop. It would be nice to support something like "unselect" or "drop" where I can drop a specific key from the result while keeping the rest.

@gboor You can use the Select method to keep the field you want in the result. Which eventually drops the fields you want to disappear.

@thedevsaddam , that's not the point. Here proposed to add new function for case where Select doesn't fit good. Function Select is "keep_if" operation but sometimes is also useful "drop_if" operation.