code: def load_structure_from_file(context: InstaloaderContext, filename: str) -> JsonExportable:
      
      compressed = filename.endswith('.xz')
      if compressed:
          fp = lzma.open(filename, 'rt')
      else:
          fp = open(filename, 'rt')
      json_structure = json.load(fp)
      fp.close()
      if 'node' in json_structure and 'instaloader' in json_structure and \
              'node_type' in json_structure['instaloader']:
          node_type = json_structure['instaloader']['node_type']
          if node_type == "Post":
              return Post(context, json_structure['node'])
          elif node_type == "Profile":
              return Profile(context, json_structure['node'])
          elif node_type == "StoryItem":
              return StoryItem(context, json_structure['node'])
          else:
              raise InvalidArgumentException("{}: Not an Instaloader JSON.".format(filename))
      elif 'shortcode' in json_structure:
          # Post JSON created with Instaloader v3
          return Post.from_shortcode(context, json_structure['shortcode'])
      else:
          raise InvalidArgumentException("{}: Not an Instaloader JSON.".format(filename))
docs: Loads a :class:`Post`, :class:`Profile` or :class:`StoryItem` from a '.json' or '.json.xz' file that
      has been saved by :func:`save_structure_to_file`.
  
      :param context: :attr:`Instaloader.context` linked to the new object, used for additional queries if neccessary.
      :param filename: Filename, ends in '.json' or '.json.xz'