input: Write a function to parse a json-formatted string into a dictionary. If the input string is not valid json, the function should return an empty dictionary.
  assert parse_json_string('{"name": "John","age": 30,"address": {"city": "New York","state": "NY"}}')=={"name": "John","age": 30,"address": {"city": "New York","state": "NY"}}
  assert parse_json_string('{"invalid": "json")=={}
  assert parse_json_string('[]')=={}
  assert parse_json_string('')=={}
  assert parse_json_string('{"key": "value"}')=={"key": "value"}
output: import json
  
  def parse_json_string(s):
      try:
          return json.loads(s)
      except json.JSONDecodeError:
          return {}