For starters, that isn't a valid JSON format. If you're ever unsure, you can run it through JSON Lint
For the sake of this example, I turned it into a valid JSON object by simply adding a closing brace at the end:
{
"x": {
"y": {
"a": "27 Jan 2022",
"b": "20:20:02 WIB"
}
}
}
Then it should be a simple key mapping. You just missed the first level is all:
data["x"]["y"]
Put into practice, the end result looks something like this:
import 'dart:io';
import 'dart:convert';
void main() async {
var request = await HttpClient().getUrl(Uri.parse("https://reqres.in/api/users?per_page=5&page=1"));
var response = await request.close();
await for (var contents in response.transform(Utf8Decoder())) {
var jsondata = jsonDecode(contents);
var targetdata = jsondata["data"][0]["email"];
}
}
The full decoded JSON data:
{
page: 1,
per_page: 5,
total: 12,
total_pages: 3,
data: [{
id: 1,
email: george.bluth @reqres.in,
first_name: George,
last_name: Bluth,
avatar: https: //reqres.in/img/faces/1-image.jpg}, {id: 2, email: janet.weaver@reqres.in, first_name: Janet, last_name: Weaver, avatar: https://reqres.in/img/faces/2-image.jpg}, {id: 3, email: emma.wong@reqres.in, first_name: Emma, last_name: Wong, avatar: https://reqres.in/img/faces/3-image.jpg}, {id: 4, email: eve.holt@reqres.in, first_name: Eve, last_name: Holt, avatar: https://reqres.in/img/faces/4-image.jpg}, {id: 5, email: charles.morris@reqres.in, first_name: Charles, last_name: Morris, avatar: https://reqres.in/img/faces/5-image.jpg}], support: {url: https://reqres.in/#support-heading, text: To keep ReqRes free, contributions towards server costs are appreciated!}}
The specific value you want to target (targetdata):
george.bluth@reqres.in