Hi,
i need to parse this json with geoevent 10.5.0 (device send temperature, humidity and battery level).
SyntaxEditor Code Snippet
{ "measurements": [ { "doubleValue": 95.66929133858267, "type": "Battery", "unit": "%" }, { "doubleValue": 100, "type": "Humidity", "unit": "%" }, { "doubleValue": 11.375, "type": "Temperature", "unit": "�C" }, { "doubleValue": 11.375, "type": "Temperature_Rosee", "unit": "�C" } ], "port": 3, "deviceName": "Azay-Le-Rideau RD 751 - PR 56", "deviceReference": null, "deviceTypeRef": null, "eui": "70b3d580a01034f1", "gatewayEui": null, "payloadHex": "03f3847c893000b668", "rssi": 0, "seqn": 1587, "size": 0, "datr": null, "freq": null, "snr": 0, "latitude": 47.22267150878906, "longitude": 0.49931803345680237, "spreadFactor": 0, "timestamp": "2018-04-04T13:59:36.871Z"} I created an input : geoevent definitation created by geoevent : i use a field mapper
in my output i have this :
CD37synox-rest-json-in,"[{""doubleValue"":18.3125,""type"":""Temperature"",""unit"":""°c""},{""doubleValue"":18.3125,""type"":""Temperature_Rosee"",""unit"":""°c""},{""doubleValue"":100.0,""type"":""Humidity"",""unit"":""%""},{""doubleValue"":94.48818897637796,""type"":""Battery"",""unit"":""%""}]",3,Tork RD 7060 - PR 70,,,70b3d580a010353f,,03f086718930012567,0,3421,0,,,0,47.122864,0.43538886,0,2018-04-25T11:40:37.954+02:00
my problem is how to seperate all values from measurements array.
i try with this but i have the same results.
i try to put in input JSON Object Name = measurements, but geoevent definition is not ok :
i try to split with GitHub - Esri/field-splitter-for-geoevent: ArcGIS GeoEvent Server Sample Processor for Splitting fie...
but after i have 4 rows in my output.
Could you help me to understand how to recover unique value Battery, Humidity, Temperature, Temperature_Rosee and other fileds in the same record ?
(after i need to create a table to store data and send a notification when temperature is under 3°C)
We find a solution by using a processor : Field Calculator (Regular Expression).
1. we use a unique field in GeoEvent definition otherwise group measurments.
2. we create a definition with all field we need :
3. In service, we use field mapper to keep part of array in new field :
dans les champs comme temperature json we have now : [{""doubleValue"":21.375,""type"":""Temperature"",""unit"":""°c"",""date"":null}
4. with field calculator regular experssion, we keep numeric characters :
we did it for each values.
Geoevent is powerfull !!
Hi, I’m trying to do something similar
In step 1 you change the type of the field that contains the array of objects to string . Is this done in the geoevent definition that results from the input adapter ?
Sorry for the delay. Yes it's done in Geoevent definition because i need to access to value as string to work with array.