input: Write a function to create a feature extraction function in Python to extract data from a json string. The function should return a dictionary containing the 'id', 'title' and the length of the 'body' text. If the input string is not a valid json string, the function should return None.
  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': 26}
  assert feature_extraction('{"id":222,"title":"Another title","body":"Short body"}')=={'id': 222, 'title': 'Another title', 'body_len': 10}
  assert feature_extraction('{"id":333,"title":"","body":""}')=={'id': 333, 'title': '', 'body_len': 0}
  assert feature_extraction('invalid json string')==None
  assert feature_extraction('')==None
output: def feature_extraction(json_str):
      try:
          data = json.loads(json_str)
          return {'id': data['id'], 'title': data['title'], 'body_len': len(data['body'])}
      except (json.JSONDecodeError, KeyError):
          return None