code: def vocab_from_json(
      path: str, encoding: str = C.VOCAB_ENCODING
  ) -> Vocab:
      """
      Saves vocabulary in json format.
  
      :param path: Path to json file containing the vocabulary.
      :param encoding: Vocabulary encoding.
      :return: The loaded vocabulary.
      """
      with open(path, encoding=encoding) as inp:
          vocab = json.load(inp)
          utils.check_condition(
              is_valid_vocab(vocab), "Vocabulary %s not valid." % path
          )
          logger.info(
              'Vocabulary (%d words) loaded from "%s"', len(vocab), path
          )
          return vocab
  
imports: import argparse
  import json
  import logging
  import os
  from collections import Counter
  from itertools import chain, islice
  from typing import Dict, Iterable, List, Optional, Tuple, Callable
  from sockeye.log import setup_main_logger
  from .None import constants
  from .None import utils
label_desc: Use image node_id 8 for calling a global function with example usage: vocab_from_json(path, encoding) and returns: vocab