Skip to main content
Question

extraction


gis2020
Participant
Forum|alt.badge.img

Hi All,

i am working with json feature extraction not really good with working on this format.I am kind of stuck at point wherein json file information is in the form of array . i am trying to extract information from featurepropertiesEntries which has information about uuid of the feature and other attribute information associated to feature in sub- array form (featureid this the main uuid ,attributevalueid id of the that attrbute ,propertyname like height info,frc ). from this array i want to extract information for specific attributes only like frc,positional accuracy etc i have tires few things with json fragmenter and extractor but not getting desired outputs. can someone suggest good option to do this

thank you in advance.

 

9 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • December 3, 2019

When working with JSON, I have had a lot of success using the Hub transformer ListKeyValuePairExtractor.

That transformer takes a list and converts it to attributes.

Hope this helps.


gis2020
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • December 3, 2019
erik_jan wrote:

When working with JSON, I have had a lot of success using the Hub transformer ListKeyValuePairExtractor.

That transformer takes a list and converts it to attributes.

Hope this helps.

hi erik jan could you share more details about these transformers and there usage.


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • December 3, 2019
gis2020 wrote:

hi erik jan could you share more details about these transformers and there usage.

I added a screenshot of the transformer, the settings and the help page.


gis2020
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • December 4, 2019
erik_jan wrote:

I added a screenshot of the transformer, the settings and the help page.

@erik_jan i tried this but this didnt worked in my case. is there any other transformer or method i can use for this .


takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • December 4, 2019

Could you please share the raw JSON document with us?


takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • December 4, 2019

In my observation, there are some "featurePropertyEntries" objects with two different JSON paths.

As the first step, you can extract every object under those "featurePropertyEnetires" using JSON Fragmenters separately with these JSON Queries.

json["messagePayload"]["featurePropertyEntries"][*]
 
json["messagePayload"]["deltaCollection"]["removedObjectsIds"]["featurePropertyEntries"][*]

 

Alternatively if you can treat all the elements in the same subsequent workflow, you can also extract them with this single JSON Query.

json["messagePayload"]["featurePropertyEntries"][*] + json["messagePayload"]["deltaCollection"]["removedObjectsIds"]["featurePropertyEntries"][*]

 

Firstly try the queries and see the result, then tell us what result you need finally.

 


takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • December 4, 2019
takashi wrote:

In my observation, there are some "featurePropertyEntries" objects with two different JSON paths.

As the first step, you can extract every object under those "featurePropertyEnetires" using JSON Fragmenters separately with these JSON Queries.

json["messagePayload"]["featurePropertyEntries"][*]
 
json["messagePayload"]["deltaCollection"]["removedObjectsIds"]["featurePropertyEntries"][*]

 

Alternatively if you can treat all the elements in the same subsequent workflow, you can also extract them with this single JSON Query.

json["messagePayload"]["featurePropertyEntries"][*] + json["messagePayload"]["deltaCollection"]["removedObjectsIds"]["featurePropertyEntries"][*]

 

Firstly try the queries and see the result, then tell us what result you need finally.

 

You can then use another JSONFragmenter to extract every element in the JSON array and flatten pairs of name and value into feature attributes.

0684Q00000ArMadQAF.png

Or, you can also use a single JSONFragmenter with this JSON Query to get the same result directly from the original JSON document.

json["messagePayload"]["featurePropertyEntries"][*][*]

gis2020
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • December 5, 2019
takashi wrote:

You can then use another JSONFragmenter to extract every element in the JSON array and flatten pairs of name and value into feature attributes.

0684Q00000ArMadQAF.png

Or, you can also use a single JSONFragmenter with this JSON Query to get the same result directly from the original JSON document.

json["messagePayload"]["featurePropertyEntries"][*][*]

Thank a lot @takashi tahnk you for for your solution it's working fine .

earlier i have tried this but it didn't worked as i didnt use the fragmenter 2nd time as you mention . 

 

thanks again for your help :)


Forum|alt.badge.img
  • December 10, 2019

Hello I recently faced same issue. Try to use Jason Fragmented, and after in JSON Flattener in attribute to expose manually enter name of attributes you trying to expose. This worked for me.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings