Question

Json attribute handler and breakdown

  • 18 February 2019
  • 6 replies
  • 0 views

HI All,

I am trying to breakdown the JSON message

{"version":254051434,"logicalTransaction":{"uuid":"009be648-ce4e-4444-ae2d-a2627e427927","edits":[{"type":"Attach MetaData","metadata":{"objectId":"009be648-ce4e-4444-ae2d-a2627e427927","objectType":"TRANSACTION","additionalId":null,"key":"ProjectID","values":[{"value":"Qteam_Tori_Pilot"}]},"groupId":1},{"type":"Attach MetaData","metadata":{"objectId":"009be648-ce4e-4444-ae2d-a2627e427927","objectType":"TRANSACTION","additionalId":null,"key":"ToolName","values":[{"value":"tori-tx-creator"}]},"groupId":2},{"type":"Attach MetaData","metadata":{"objectId":"009be648-ce4e-4444-ae2d-a2627e427927","objectType":"TRANSACTION","additionalId":null,"key":"ToolVersion","values":[{"value":"0.0.19"}]},"groupId":3},{"type":"Attach MetaData","metadata":{"objectId":"009be648-ce4e-4444-ae2d-a2627e427927","objectType":"TRANSACTION","additionalId":null,"key":"UserID","values":[{"value":"svc_qteam"}]},"groupId":4},{"type":"CreateGeometry","featureType":"ccom:4_0:ccom-Core:RoadElement","geometry":{"type":"LineString","coordinates":[[-412716042,-217824135],[-412710157,-217826553]]},"editOptions":{"cascadeEditOptions":{"cascadeStrategy":{"type":"FullCascadeStrategy","enabledTypes":[]}},"coreDBSnapOption":10000},"groupId":5},{"type":"Update Feature Attributes","geometry":{"type":"LineString","coordinates":[[-412716042,-217824135],[-412710157,-217826553]]},"ID":"c6f70de1-c3fa-4455-abac-cef95063ccf8","featureType":"ccom:4_0:ccom-Core:RoadElement","attributesAfterChange":[{"ccom:4_0:ccom-Core:RoadElement.FRC":"LocalRoadOfMinorImportance"},{"ccom:4_0:ccom-Core:RoadElement.Net2Class":"Net2Class6"},{"ccom:4_0:ccom-Core:RoadElement.PositionalAccuracy":"Medium"},{"ccom:4_0:ccom-Core:RoadElement.RoadCondition":"Unpaved"}],"changedAttributesNames":["ccom:4_0:ccom-Core:RoadElement.FRC","ccom:4_0:ccom-Core:RoadElement.Net2Class","ccom:4_0:ccom-Core:RoadElement.PositionalAccuracy","ccom:4_0:ccom-Core:RoadElement.RoadCondition"],"groupId":6},{"type":"Attach MetaData","metadata":{"objectId":"009be648-ce4e-4444-ae2d-a2627e427927","objectType":"TRANSACTION","additionalId":null,"key":"async","values":[{"value":"true"}]},"groupId":7},{"type":"PreCommit","transactionId":"009be648-ce4e-4444-ae2d-a2627e427927","fromEditIndex":0,"toEditIndex":6,"editOptions":{"cascadeEditOptions":{"cascadeStrategy":{"type":"FullCascadeStrategy","enabledTypes":[]}}},"groupId":8}]}}.

I want to extract the coordinate values from this message. I have used the Json flattner but not getting results as expected. can somebody help me to break down this message?

 

Thank you in advance.


6 replies

Userlevel 6
Badge +33

Depending on the need you could use the JsonFragmenter with the query

json["logicalTransaction"]["edits"][*]["geometry"]["coordinates"][*]

To fragment the coordinate pairs.

0684Q00000ArKFsQAN.png

fragmentjson.fmwt

Depending on the need you could use the JsonFragmenter with the query

json["logicalTransaction"]["edits"][*]["geometry"]["coordinates"][*]

To fragment the coordinate pairs.

0684Q00000ArKFsQAN.png

fragmentjson.fmwt

Thank you @nielsgerrits  for helping. this is my first time with json transformers. I tried to use the query in json fragmentor but it's getting rejected. could you please suggest.

 

Userlevel 6
Badge +33

Thank you @nielsgerrits for helping. this is my first time with json transformers. I tried to use the query in json fragmentor but it's getting rejected. could you please suggest.

 

Hard to say what went wrong without workspace. Attached a working workspace to initial answer to play around with. Make sure you validate the Json before working with it. Saves a lot of headaches. https://jsonlint.com/ can help as well.

Hi @nielsgerrits please find the attached workspace.

converter.fmwt

Userlevel 6
Badge +33

Hi @nielsgerrits please find the attached workspace.

converter.fmwt

I don't get any results from the HttpCaller, but I would advise to start with one record from the source file to make the problem less complicated. You could also use a Sampler to let only the first record pass.

Depending on the need you could use the JsonFragmenter with the query

json["logicalTransaction"]["edits"][*]["geometry"]["coordinates"][*]

To fragment the coordinate pairs.

0684Q00000ArKFsQAN.png

fragmentjson.fmwt

thank you @nielsgerrits it worked after modifying the query.

Reply