Package net.minidev.json.actions.navigate
Navigate user-specified paths in a tree made up of
Maps and List and process them
TreeNavigator only navigates through branches
corresponding to user-specified paths. For each path, the navigation starts at the root and moves
down the branch.
The TreeNavigator accepts a NavigateAction and provides callback hooks at each significant
step which the NavigateAction may use to process the
nodes.
A path to navigate must be specified in the n-gram format - a list of keys from the root down
separated by dots: K0[[[[.K1].K2].K3]...]
A key to the right of a dot is a direct child of a key to the left of a dot. Keys with a dot in
their name are not supported.
Sample usage:
NavigateAction navAction = new NavigateAction(){...};
JSONNavigator jsonNav = new JSONNavigator(navAction, "foo.bar.path");
jsonNav.nav(new JSONObject(...));
Object result = navAction.result();
-
Interface Summary Interface Description JSONNavigateAction An interface for a processing action on the nodes of aJSONObjectwhile navigating its branches.NavigateAction<M extends java.util.Map<java.lang.String,java.lang.Object>,L extends java.util.List<java.lang.Object>> An interface for a processing action on the nodes of aNavigateActionwhile navigating its branches. -
Class Summary Class Description CopyPathsAction Creates a copy of aJSONObjectcontaining just the nodes on the paths specified.JSONNavigator A navigator that operates on JSON objects and arrays for path-based navigation.TreeNavigator<M extends java.util.Map<java.lang.String,java.lang.Object>,L extends java.util.List<java.lang.Object>> Navigates only the branches of aJSONObjectcorresponding to the paths specified.