So the issue is that the returned JSON has another step in the path before explanation which is why your code is returning null, as at the 'top level' there is no 'explanation' key.
Here is the returned JSON:
{
"Status": 0,
"Content": "{\"date\":\"2020-12-14\",\"explanation\":\"The streak across the sky is a capsule returning from an asteroid. It returned earlier this month from the near-Earth asteroid 162173 Ryugu carrying small rocks and dust from its surface. The canister was released by its mothership, Japan's Hayabusa2, a mission that visited Ryugu in 2018, harvested a surface sample in 2019, and zoomed back past Earth. The jettisoned return capsule deployed a parachute and landed in rural Australia. A similar mission, NASA's OSIRIS- REx, recently captured rocks and dust from a similar asteroid, Bennu, and is scheduled to return its surface sample to Earth in 2023. Analyses of compounds from these asteroids holds promise to give humanity new insights about the early Solar System and new clues about how water and organic matter came to be on Earth. Experts Debate: How will humanity first discover extraterrestrial life?\",\"media_type\":\"video\",\"service_version\":\"v1\",\"title\":\"Capsule Returns from Asteroid Ryugu\",\"url\":\"https://www.youtube.com/embed/NuLuCeawQSo?rel=0\"}\n"
}
Which as you may notice, by the escape characters, is an object that contains an Object String inside of it.
The only two keys in this object are 'Status' and 'Content'. As the explanation part you want is inside the Content key, you will need to use the following code to get the Content value.
var content = json.Content
Now as a note, although this is a string Object, it needs to be Parsed (like you did previously to get your json var) to be used.
var cObj = Platform.Function.ParseJSON(content);
Which will give the following Object:
{
"date": "2020-12-14",
"explanation": "The streak across the sky is a capsule returning from an asteroid. It returned earlier this month from the near-Earth asteroid 162173 Ryugu carrying small rocks and dust from its surface. The canister was released by its mothership, Japan's Hayabusa2, a mission that visited Ryugu in 2018, harvested a surface sample in 2019, and zoomed back past Earth. The jettisoned return capsule deployed a parachute and landed in rural Australia. A similar mission, NASA's OSIRIS- REx, recently captured rocks and dust from a similar asteroid, Bennu, and is scheduled to return its surface sample to Earth in 2023. Analyses of compounds from these asteroids holds promise to give humanity new insights about the early Solar System and new clues about how water and organic matter came to be on Earth. Experts Debate: How will humanity first discover extraterrestrial life?",
"media_type": "video",
"service_version": "v1",
"title": "Capsule Returns from Asteroid Ryugu",
"url": "https://www.youtube.com/embed/NuLuCeawQSo?rel=0"
}
Which you can now use to get your 'explanation' key:
var expl = cObj.explanation;
Which would output:
The streak across the sky is a capsule returning from an asteroid. It returned earlier this month from the near-Earth asteroid 162173 Ryugu carrying small rocks and dust from its surface. The canister was released by its mothership, Japan's Hayabusa2, a mission that visited Ryugu in 2018, harvested a surface sample in 2019, and zoomed back past Earth. The jettisoned return capsule deployed a parachute and landed in rural Australia. A similar mission, NASA's OSIRIS- REx, recently captured rocks and dust from a similar asteroid, Bennu, and is scheduled to return its surface sample to Earth in 2023. Analyses of compounds from these asteroids holds promise to give humanity new insights about the early Solar System and new clues about how water and organic matter came to be on Earth. Experts Debate: How will humanity first discover extraterrestrial life?
The final code would be:
<script runat="server">
Platform.Load("Core","1.1.5");
var url="https://api.nasa.gov/planetary/apod?api_key=7Apb3QN7qVsXPuPDcSZBKAPf8twca03C5w4Oxuyc";
var response;
var json;
var picurl;
var explanation;
try {
response=HTTP.Get(url);
str=Stringify(response);
json=Platform.Function.ParseJSON(str);
var content = json.Content;
var cObj = Platform.Function.ParseJSON(content);
explanation=cObj.explanation;
Write("Respone: " + Stringify(json)+"<br><br>");
Write("Explanation: " + explanation);
} catch(error) {
Write(Stringify(error));
}
</script>