input: Write a function to parse a given json-formatted string into a dictionary. If the input string is not in valid json format, return None. 
  
  def json_to_dict(json_str):
      try:
          return json.loads(json_str)
      except json.JSONDecodeError:
          return None
  
  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('{"name": "John","age": 30,"address": {"city": "New York","state:"NY"}}') == None
  assert json_to_dict('') == None
  assert json_to_dict('[]') == []
output: def json_to_dict(json_str):
      try:
          return json.loads(json_str)
      except json.JSONDecodeError:
          return None