input: Write a function to extract features from a JSON string and return a dictionary containing the id, title, and the length of the body text. The JSON string should be parsed and the data should be extracted accordingly. The function should accept a string as input and return a dictionary as output.
  
  def feature_extraction(input_str):
      import json
      data = json.loads(input_str)
  
      features = {
          "id": data["id"],
          "title": data["title"],
          "body_len": len(data["body"])
      }
  
      return features
  
  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": 28}
output: def feature_extraction(input_str):
      import json
      data = json.loads(input_str)
  
      features = {
          "id": data["id"],
          "title": data["title"],
          "body_len": len(data["body"])
      }
  
      return features