Member since
04-03-2024
3
Posts
1
Kudos Received
0
Solutions
04-04-2024
09:15 PM
1 Kudo
Thank you for your solution. It was a lot of inspiration for me. Therefore, I would like to ask you another question. Expected data: {
"cloud_amount0" : "link data0",
"cloud_amount1" : "link data1", "cloud_amount2" : "link data2", "cloud_amount3" : "link data3",
} Is there a jolt whose key name is dynamically increasing like 'cloud_mount'?
... View more
04-03-2024
07:11 PM
I want to convert json data with both Object and Array into Object at once. I used jolt, but I didn't reach the desired result. The json data is as follows. Input Data: {
"response": {
"header": {
"resultCode": "00",
"resultMsg": "NORMAL_SERVICE"
},
"body": {
"dataType": "XML",
"items": {
"item": {
"icaoCode": null,
"airportName": null,
"metarMsg": {
"METAR": {
"automatedStation": false,
"id": "metar-RKSS-20240404000000Z",
"permissibleUsage": "OPERATIONAL",
"status": "NORMAL",
"schemaLocation": "link data link data link data link data link data",
"extension": {
"msgText": "METAR RKSS 040000Z 09007KT 030V120 9999 SCT035 BKN150 15/05 \n Q1015 NOSIG="
},
"observation": {
"OM_Observation": {
"id": "obs-RKSS-20240404000000Z",
"type": {
"href": "link data"
},
"phenomenonTime": {
"TimeInstant": {
"id": "ti-20240404000000Z",
"timePosition": "2024-04-04T00:00:00Z"
}
},
"resultTime": {
"href": "#ti-20240404000000Z"
},
"procedure": {
"Process": {
"id": "p-49-2-metar",
"description": "WMO No. 49 Volume 2 Meteorological Service for International Air Navigation APPENDIX 3 TECHNICAL SPECIFICATIONS RELATED TO METEOROLOGICAL OBSERVATIONS AND REPORTS"
}
},
"observedProperty": {
"href": "link data"
},
"featureOfInterest": {
"SF_SpatialSamplingFeature": {
"id": "sp-RKSS",
"type": {
"href": "link data"
},
"sampledFeature": {
"AirportHeliport": {
"id": "aerodrome-RKSS",
"timeSlice": {
"AirportHeliportTimeSlice": {
"id": "aerodrome-RKSS-ts",
"validTime": null,
"interpretation": "BASELINE",
"designator": "RKSS",
"name": "GIMPO INTERNATIONAL AIRPORT",
"locationIndicatorICAO": "RKSS"
}
}
}
},
"shape": {
"Point": {
"axisLabels": "Latitude Longitude Altitude",
"id": "obs-point-RKSS",
"srsName": "link data",
"uomLabels": "deg deg m",
"pos": "37.33 126.48 18.0"
}
}
}
},
"result": {
"MeteorologicalAerodromeObservationRecord": {
"cloudAndVisibilityOK": false,
"id": "observation-record-RKSS-20240404000000Z",
"airTemperature": {
"uom": "Cel",
"$": 15
},
"dewpointTemperature": {
"uom": "Cel",
"$": 5
},
"qnh": {
"uom": "hPa",
"$": 1015
},
"surfaceWind": {
"AerodromeSurfaceWind": {
"variableWindDirection": false,
"meanWindDirection": {
"uom": "deg",
"$": 90
},
"meanWindSpeed": {
"uom": "[kn_i]",
"$": "007"
},
"extremeClockwiseWindDirection": {
"uom": "deg",
"$": 120
},
"extremeCounterClockwiseWindDirection": {
"uom": "deg",
"$": "030"
}
}
},
"visibility": {
"AerodromeHorizontalVisibility": {
"prevailingVisibility": {
"uom": "m",
"$": 10000
}
}
},
"cloud": {
"AerodromeObservedClouds": {
"layer": [
{
"CloudLayer": {
"amount": {
"href": "link data"
},
"base": {
"uom": "[ft_i]",
"$": 3500
},
"cloudType": {
"href": "link data",
"title": "Stratocumulus"
}
}
},
{
"CloudLayer": {
"amount": {
"href": "link data"
},
"base": {
"uom": "[ft_i]",
"$": 15000
},
"cloudType": {
"href": "link data",
"title": "Altocumulus"
}
}
}
]
}
}
}
}
}
},
"trendForecast": {
"OM_Observation": {
"id": "trend-fcst-1",
"type": {
"href": "link data"
},
"phenomenonTime": {
"href": "#ti-20240404000000Z"
},
"resultTime": {
"href": "#ti-20240404000000Z"
},
"procedure": {
"href": "#p-49-2-metar"
},
"observedProperty": {
"href": "link data"
},
"featureOfInterest": {
"href": "#sp-RKSS"
},
"result": {
"MeteorologicalAerodromeTrendForecastRecord": {
"changeIndicator": "NO_SIGNIFICANT_CHANGES",
"cloudAndVisibilityOK": false,
"id": "trend-fcst-record-1-20240404000000Z"
}
}
}
}
}
}
}
},
"numOfRows": 10000,
"pageNo": 1,
"totalCount": 1
}
}
} Jolt Spec: [
{
"operation": "shift",
"spec": {
"response": {
"body": {
"items": {
"item": {
"*": {
"*": {
"extension": {
"msgText": "msgText"
},
"observation": {
"OM_Observation": {
"phenomenonTime": {
"TimeInstant": {
"timePosition": "phenomenonTime"
}
},
"featureOfInterest": {
"SF_SpatialSamplingFeature": {
"sampledFeature": {
"AirportHeliport": {
"timeSlice": {
"AirportHeliportTimeSlice": {
"name": "featureOfInterest"
}
}
}
},
"shape": {
"Point": {
"pos": "shape"
}
}
}
},
"result": {
"MeteorologicalAerodromeObservationRecord": {
"airTemperature": {
"\\$": "airTemperature"
},
"dewpointTemperature": {
"\\$": "dewpointTemperature"
},
"qnh": {
"\\$": "qnh"
},
"surfaceWind": {
"AerodromeSurfaceWind": {
"meanWindDirection": {
"\\$": "meanWindDirection"
},
"meanWindSpeed": {
"\\$": "meanWindSpeed"
},
"windGustSpeed": {
"\\$": "windGustSpeed"
},
"extremeClockwiseWindDirection": {
"\\$": "extremeClockwiseWindDirection"
},
"extremeCounterClockwiseWindDirection": {
"\\$": "extremeCounterClockwiseWindDirection"
}
}
},
"visibility": {
"AerodromeHorizontalVisibility": {
"prevailingVisibility": {
"\\$": "AerodromeHorizontalVisibility"
}
}
},
"presentWeather": {
"href": "presentWeather"
},
"cloud": {
"AerodromeObservedClouds": {
"layer": {
"*": {
"CloudLayer": {
"amount": {
"href": "cloud_amount"
},
"base": {
"\\$": "cloud_base"
},
"cloudType": {
"href": "cloudType_href",
"title": "cloudType"
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
},
{
"operation": "shift",
"spec": {
"msgText": "&",
"phenomenonTime": "&",
"featureOfInterest": "&",
"shape": "&",
"airTemperature": "&",
"dewpointTemperature": "&",
"qnh": "&",
"meanWindDirection": "&",
"meanWindSpeed": "&",
"windGustSpeed": "&",
"extremeClockwiseWindDirection": "&",
"extremeCounterClockwiseWindDirection": "&",
"AerodromeHorizontalVisibility": "&",
"cloud_amount": "&",
"cloud_base": "&",
"cloudType_href": "&",
"cloudType": "&",
"presentWeather": "&"
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"airTemperature": "=toString",
"dewpointTemperature": "=toString",
"qnh": "=toString",
"meanWindDirection": "=toString",
"meanWindSpeed": "=toString",
"extremeClockwiseWindDirection": "=toString",
"extremeCounterClockwiseWindDirection": "=toString",
"AerodromeHorizontalVisibility": "=toString",
"cloud_amount": "=toString",
"cloud_base": "=toString",
"cloudType_href": "=toString",
"cloudType": "=toString"
}
}
] OutPut Data: {
"msgText" : "METAR RKSS 040000Z 09007KT 030V120 9999 SCT035 BKN150 15/05 \n Q1015 NOSIG=",
"phenomenonTime" : "2024-04-04T00:00:00Z",
"featureOfInterest" : "GIMPO INTERNATIONAL AIRPORT",
"shape" : "37.33 126.48 18.0",
"airTemperature" : "15",
"dewpointTemperature" : "5",
"qnh" : "1015",
"meanWindDirection" : "90",
"meanWindSpeed" : "007",
"extremeClockwiseWindDirection" : "120",
"extremeCounterClockwiseWindDirection" : "030",
"AerodromeHorizontalVisibility" : "10000",
"cloud_amount" : [ "link data", "link data" ],
"cloud_base" : [ "3500", "15000" ],
"cloudType_href" : [ "link data", "link data" ],
"cloudType" : [ "Stratocumulus", "Altocumulus" ]
} Expected data: {
"msgText" : "METAR RKSS 040000Z 09007KT 030V120 9999 SCT035 BKN150 15/05 \n Q1015 NOSIG=",
"phenomenonTime" : "2024-04-04T00:00:00Z",
"featureOfInterest" : "GIMPO INTERNATIONAL AIRPORT",
"shape" : "37.33 126.48 18.0",
"airTemperature" : "15",
"dewpointTemperature" : "5",
"qnh" : "1015",
"meanWindDirection" : "90",
"meanWindSpeed" : "007",
"extremeClockwiseWindDirection" : "120",
"extremeCounterClockwiseWindDirection" : "030",
"AerodromeHorizontalVisibility" : "10000",
"cloud_amount0" : "link data",
"cloud_amount1" : "link data"
"cloud_base0" : "3500",
"cloud_base1" : "15000",
"cloudType_href0" : "link data",
"cloudType_href1" : "link data",
"cloudType0" : "Stratocumulus",
"cloudType1" : "Altocumulus"
} As above, could you please advise a jolt script in which the data I expect is output?
... View more
Labels:
- Labels:
-
Apache NiFi