input: Write a function to create a feature extraction function in Python that extracts data from a json string. The function should return a dictionary containing the "id", "title", and the length of the "body" from the input json string. If the input json string is empty, the function should return an empty dictionary.
  assert feature_extraction('{"id":111,"title":"This is a sample title","body":"This is a sample body text"}')=={"id": 111, "title": "This is a sample title", "body_len": 33}
  assert feature_extraction('{"id":222,"title":"Another title","body":"Another body text"}')=={"id": 222, "title": "Another title", "body_len": 18}
  assert feature_extraction('{}')=={}
  assert feature_extraction('')=={}
output: def feature_extraction(json_str):
      if not json_str:
          return {}
      data = json.loads(json_str)
      return {
          "id": data.get("id"),
          "title": data.get("title"),
          "body_len": len(data.get("body", ""))
      }