preparation of JSON data in IoT Analytics for visualization in QuickSight

0

Hello, I have JSON data which is sent by IoT device connected to IoT core via message routing rule to IoT Analytics my JSON message looks like this: { "mType": "iqrfSensor_ReadSensorsWithTypes", "data": { "msgId": "testEmbedSensor", "rsp": { "nAdr": 1, "hwpId": 2, "rCode": 0, "dpaVal": 88, "result": { "sensors": [ { "id": "TEMPERATURE", "type": 1, "name": "Temperature", "shortName": "t", "value": 26, "unit": "°C", "decimalPlaces": 4 }, { "id": "TEMPERATURE", "type": 1, "name": "Temperature", "shortName": "t", "value": 24.5, "unit": "°C", "decimalPlaces": 4 }, { "id": "BINARYDATA7", "type": 129, "name": "Binary data7", "shortName": "bin7", "value": 81, "unit": "?", "decimalPlaces": 0, "breakdown": [ { "id": "BINARYDATA7", "type": 129, "name": "Light indicator", "shortName": "light", "unit": "%", "decimalPlaces": 1, "value": 36.2 } ] }, { "id": "BINARYDATA7", "type": 129, "name": "Binary data7", "shortName": "bin7", "value": 73, "unit": "?", "decimalPlaces": 0, "breakdown": [ { "id": "BINARYDATA7", "type": 129, "name": "Potentiometer", "shortName": "pot", "unit": "%", "decimalPlaces": 1, "value": 42.5 } ] } ], "sensorIndexes": [ 0, 1, 2, 3 ] } }, "raw": [ { "request": "01.00.5e.01.ff.ff.0f.00.00.00", "requestTs": "2023-03-20T15:58:18.066+01:00", "confirmation": "01.00.5e.01.ff.ff.ff.58.01.08.01", "confirmationTs": "2023-03-20T15:58:18.091+01:00", "response": "01.00.5e.81.02.00.00.58.01.a0.01.01.88.01.81.51.81.49", "responseTs": "2023-03-20T15:58:18.346+01:00" } ], "insId": "iqrfgd2-default", "statusStr": "ok", "status": 0 } } In the IoT Analytics dataset my data is saved in csv format but I only have the fields mtype, data (in which all the data I want to work with in QuickSight is saved) and _dt How do I work with this data or what is the solution to work with nested data so that QuickSight can process it?

MikMar
asked a year ago285 views
1 Answer
1

Hi MikMar,

AWS IoT Analytics stores the data from first values from a JSON object as rows. Because you have a nested JSON the data does not arrive in a format that makes it easily consumable. You can use a Lambda function as pipeline activity to flatten your data. Please take a look at a similat setup and solution in the IoT SiteWise workshop.

Cheers,
Philipp

AWS
EXPERT
answered a year ago
  • Is there another way to process such a JSON message so I can visualize the data in QuickSight? For example, via TimeStream or other AWS service without the need for encoding?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions