input: Write a function to parse a given json-formatted string into a Python dictionary. The function should take the json-formatted string as input and return the corresponding dictionary. If the input string is not in valid json format, the function should raise a ValueError.
  assert json_to_dict('{"name": "John","age": 30,"address": {"city": "New York","state": "NY"}}')=={"name": "John","age": 30,"address": {"city": "New York","state": "NY"}}
  assert json_to_dict('{"fruit": "apple","count": 5}')=={"fruit": "apple","count": 5}
  assert json_to_dict('{"is_valid": true}')=={"is_valid": True}
  assert json_to_dict('{invalid json}')  # Should raise ValueError
  assert json_to_dict('[]')=={}  # Should raise ValueError
output: import json
  
  def json_to_dict(json_str):
      try:
          return json.loads(json_str)
      except json.JSONDecodeError:
          raise ValueError("Invalid JSON format")