def do_json_get(self, params):
        """
\x1b[1mNAME\x1b[0m
        json_get - Get key (or keys, if nested) from a JSON object serialized in the given path

\x1b[1mSYNOPSIS\x1b[0m
        json_get <path> <keys> [recursive]

\x1b[1mOPTIONS\x1b[0m
        * recursive: recurse to all children (default: false)

\x1b[1mEXAMPLES\x1b[0m
        > json_get /configs/primary_service endpoint.clientPort
        32768

        > json_get /configs endpoint.clientPort true
        primary_service: 32768
        secondary_service: 32769

        # Use template strings to access various keys at once:

        > json_get /configs/primary_service '#{endpoint.ipAddress}:#{endpoint.clientPort}'
        10.2.2.3:32768

        """
        try:
            Keys.validate(params.keys)
        except Keys.Bad as ex:
            self.show_output(str(ex))
            return

        if params.recursive:
            paths = self._zk.tree(params.path, 0, full_path=True)
            print_path = True
        else:
            paths = [(params.path, 0)]
            print_path = False

        for cpath, _ in paths:
            try:
                jstr, _ = self._zk.get(cpath)
                value = Keys.value(json_deserialize(jstr), params.keys)

                if print_path:
                    self.show_output("%s: %s", os.path.basename(cpath), value)
                else:
                    self.show_output(value)
            except BadJSON as ex:
                self.show_output("Path %s has bad JSON.", cpath)
            except Keys.Missing as ex:
                self.show_output("Path %s is missing key %s.", cpath, ex)
def do_json_get ( self , params ) : try : Keys . validate ( params . keys ) except Keys . Bad as ex : self . show_output ( str ( ex ) ) return if params . recursive : paths = self . _zk . tree ( params . path , 0 , full_path = True ) print_path = True else : paths = [ ( params . path , 0 ) ] print_path = False for cpath , _ in paths : try : jstr , _ = self . _zk . get ( cpath ) value = Keys . value ( json_deserialize ( jstr ) , params . keys ) if print_path : self . show_output ( "%s: %s" , os . path . basename ( cpath ) , value ) else : self . show_output ( value ) except BadJSON as ex : self . show_output ( "Path %s has bad JSON." , cpath ) except Keys . Missing as ex : self . show_output ( "Path %s is missing key %s." , cpath , ex )
\x1b[1mNAME\x1b[0m
        json_get - Get key (or keys, if nested) from a JSON object serialized in the given path

\x1b[1mSYNOPSIS\x1b[0m
        json_get <path> <keys> [recursive]

\x1b[1mOPTIONS\x1b[0m
        * recursive: recurse to all children (default: false)

\x1b[1mEXAMPLES\x1b[0m
        > json_get /configs/primary_service endpoint.clientPort
        32768

        > json_get /configs endpoint.clientPort true
        primary_service: 32768
        secondary_service: 32769

        # Use template strings to access various keys at once:

        > json_get /configs/primary_service '#{endpoint.ipAddress}:#{endpoint.clientPort}'
        10.2.2.3:32768