I have the Wrapper class, and the testwrapper class, but in my callout class i cant get it to only get out the value: 3.2
this the is api url: https://data.ssb.no/api/v0/no/table/11117
This is the json
{
"query": [
{
"code": "Leveringssektor",
"selection": {
"filter": "item",
"values": [
"B2"
]
}
},
{
"code": "ContentsCode",
"selection": {
"filter": "item",
"values": [
"Tolvmanedersendring"
]
}
},
{
"code": "Tid",
"selection": {
"filter": "top",
"values": [
"1"
]
}
}
],
"response": {
"format": "json-stat2"
}
}
this is the response i get when i use POST function on postman, how do i deserialize the response so i can only get the value 3.2 from the response?
{
"class": "dataset",
"label": "11117: Konsumprisindeks for varer og tjenester, etter Leveringssektor, statistikkvariabel og måned",
"source": "Statistisk sentralbyrå",
"updated": "2022-06-10T06:00:00Z",
"id": [
"Leveringssektor",
"ContentsCode",
"Tid"
],
"size": [
1,
1,
1
],
"dimension": {
"Leveringssektor": {
"label": "Leveringssektor",
"category": {
"index": {
"B2": 0
},
"label": {
"B2": "Tjenester"
}
}
},
"ContentsCode": {
"label": "statistikkvariabel",
"category": {
"index": {
"Tolvmanedersendring": 0
},
"label": {
"Tolvmanedersendring": "12-måneders endring (prosent)"
},
"unit": {
"Tolvmanedersendring": {
"base": "prosent",
"decimals": 1
}
}
}
},
"Tid": {
"label": "måned",
"category": {
"index": {
"2022M05": 0
},
"label": {
"2022M05": "2022M05"
}
}
}
},
"value": [
3.2
],
"role": {
"time": [
"Tid"
],
"metric": [
"ContentsCode"
]
},
"version": "2.0",
"extension": {
"px": {
"infofile": "None",
"tableid": "11117",
"decimals": 1
}
}
}
this is the apex code i use for deserializng, as i dont have alot of developer backend experience i dont know if this is the correct way:
public class Prosentavdeling {
public class Response {
public String format;
}
public class Query {
public String code;
public Selection selection;
}
public List<Query> query;
public Response response;
public class Selection {
public String filter;
public List<String> values;
}
public static Prosentavdeling parse(String json) {
return (Prosentavdeling) System.JSON.deserialize(json, Prosentavdeling.class);
}
}
deserializedResult.value[0]
.