Skip to main content
Question

Json attribute handler and breakdown

  • February 18, 2019
  • 6 replies
  • 17 views

gis2020
Contributor
Forum|alt.badge.img+5

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2940 replies
  • February 18, 2019

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


gis2020
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 61 replies
  • February 18, 2019

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.

 


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2940 replies
  • February 18, 2019

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.


gis2020
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 61 replies
  • February 18, 2019

Hi @nielsgerrits please find the attached workspace.

converter.fmwt


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2940 replies
  • February 18, 2019

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.


gis2020
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 61 replies
  • February 18, 2019

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.