input: Write a function to parse a json-formatted string into a dictionary. If the input string is empty, return an empty dictionary. If the input string is not in valid json format, raise a ValueError.
  
  def parse_json_to_dict(json_str):
      if not json_str:
          return {}
      try:
          return json.loads(json_str)
      except json.JSONDecodeError:
          raise ValueError("Input string is not in valid json format")
  
  assert parse_json_to_dict('{"name": "John","age": 30,"address": {"city": "New York","state": "NY"}}') == {"name": "John","age": 30,"address": {"city": "New York","state": "NY"}}
  assert parse_json_to_dict('{}') == {}
  assert parse_json_to_dict('') == {}
  try:
      parse_json_to_dict('not a json string')
      assert False  # This should not be reached
  except ValueError:
      assert True
output: 
  def parse_json_to_dict(json_str):
      if not json_str:
          return {}
      try:
          return json.loads(json_str)
      except json.JSONDecodeError:
          raise ValueError("Input string is not in valid json format")
  