Question

extraction

  • 3 December 2019
  • 9 replies
  • 18 views

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

Userlevel 2
Badge +16

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.

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.

Userlevel 2
Badge +16

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.

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 .

Userlevel 2
Badge +17

Could you please share the raw JSON document with us?

Userlevel 2
Badge +17

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.

 

Userlevel 2
Badge +17

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"][*][*]

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 :)

Badge

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.

Reply