What block should i use to fetch data from WEB API like this

{
	"data": {
		"id": 1,
		"kategori": "Peralatan",
		"nama": "Monitor",
		"merek": "HP",
		"jenis": "APBD",
		"jumlah": "5",
		"tahun_anggaran": "2022",
		"foto": "kosong",
		"detail_barang": [
			{
				"id": 1,
				"kode_barang": "APBD-1",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 2,
				"kode_barang": "APBD-2",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 3,
				"kode_barang": "APBD-3",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 4,
				"kode_barang": "APBD-4",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 5,
				"kode_barang": "APBD-5",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			}
		]
	}
}

You will need to provide more details about what you’re trying to do.

You can start learning about APIs by watching my tutorial here: API JSON Tutorial (Video).

I want to to get data from my server and i confused to make the block

can you help fix it sir

HERE THE RESPON SERVER

{
	"data": {
		"id": 3,
		"kategori": "Peralatan",
		"nama": "Mouspad",
		"merek": "Logitech",
		"jenis": "ABDB",
		"jumlah": "5",
		"tahun_anggaran": "2023",
		"foto": "1702382167.png",
		"detail_barang": [
			{
				"id": 1,
				"kode_barang": "ABDB-1",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 2,
				"kode_barang": "ABDB-2",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 3,
				"kode_barang": "ABDB-3",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 4,
				"kode_barang": "ABDB-4",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 5,
				"kode_barang": "ABDB-5",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			}
		]
	}
}

When I say that you need to give more details, you need to tell us which property:value pairs (for example, jenis”: “ABDB”) you are trying to get, and what happens when you try that. For example, what is the value of the green error block?

image

i get data
image

but when i change with ruangan i get null

if i change with detail_barang i get looping object object


image

There is no property named “jenis” in the “detail_barang” list. Here’s the tree view from Best JSON Viewer and JSON Beautifier Online using your JSON response:

When you get each item Barang in that list, the only properties you can then get are:

  • “id”
  • “kode_barang”
  • “ruangan”
  • “kondisi”

You can try replacing “jenis” with “ruangan” but you need a wait block after the set Label8's Text block so that you can see each value as it loops.

My video tutorial explains how to do all of this and how to avoid the problems you’re having parsing the JSON response.