Altova XMLSpy 2024 Professional Edition

Filters enable you to filter the display of objects and arrays. For example, in the screenshot below, a filter (which is an XQuery 3.1 expression) has been applied to an array so that only those tracks written by Brian May are displayed. In JSON terms, only those object children of Tracks are displayed that have a Writer property containing the string value Brian May. The filter's XQuery expression looks up all child objects of Tracks and selects those for which a lookup of the Writer property matches the string 'Brian May'.




Each filter is executed independently and is not affected by other filters or formulas in the document.


For information about constructing XQuery expressions for JSON documents, see the section XQuery Expressions for JSON.


Note:When entering expressions for filters and formulas in Grid View, you might want to display an expression over several lines for better readability. To add a new line in the expression, press Ctrl+Enter.


Set up a filter

To set up a filter, right-click the element you want to filter, select Filter from the context menu that appears, enter the XQuery expression, and click Enter. The Filter cell is indicated by the icon ic_jsongridfilteroff (see screenshot above). You can activate/deactivate the filter by clicking the Filter icon.


Note the following points about filters:


Filters can be applied only to objects and arrays.

The context node of the filter's XQuery expression is the current node. In the screenshot above, for example, the context node of the filter's XQuery expression is the Tracks node.

Filters are not stored in the JSON document as JSON content, but can be kept in a special metadata file for subsequent use. If the filters are stored, they will be automatically applied to the respective object/array when the document is re-opened in JSON Grid View.

Filters can be nested. A nested filter will be applied to the filtered content of the parent filter.

To add a new line in an expression, press Ctrl+Enter.


© 2017-2023 Altova GmbH