input: Write a function to parse a json-formatted string into a dictionary. The function should return the dictionary if the parsing is successful, otherwise it should return None.
  
  
  import json
  
  def parse_json_to_dict(json_str):
      try:
          return json.loads(json_str)
      except json.JSONDecodeError:
          return None
  
  # Test cases
  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('{"name": "John", "age": "30"}') == {"name": "John", "age": "30"}
  assert parse_json_to_dict('{"invalid_json": True') == None
  assert parse_json_to_dict('') == None
  
output: def parse_json_to_dict(json_str):
      try:
          return json.loads(json_str)
      except json.JSONDecodeError:
          return None