Question

Converting json into excel table

  • 29 June 2016
  • 4 replies
  • 51 views

Badge

Hello

I am trying to convert a json file into an excel spreadsheet with each json attribute in it's own column. I am playing around with jsonflattener and attributeexposer however this has been quite difficult. I was wondering if any expert could help.

Many thanks!

@takashi

Here is a view of the json file


4 replies

Userlevel 2
Badge +17

Hi @latias9787, I think the JSONFragmenter would be suitable.

  • JSON Query: json["features"][*]
  • Flatten Query Result into Attributes: Yes
  • Recursively Flatten Objects/Arrays: Yes

The transformer with this setting flattens every object contained by the "features" array simultaneously. The schema of the objects is a little bit complex. Check the extracted attribute names with the Feature Information window of FME Data Inspector.

In addition, looks like it's a GeoJSON object. If you don't need to flatten "geometry" objects, the GeoJSON reader might be further easier.

Badge

Hi takashi

Thanks for the swift response, I am still a bit unsure on what to do, I have attached the JSONFragmenter however no features have been written. I am trying to parse each object's field so that each row would contain a object with the relevant attributed inserted ie type, id, speedlimit. I am just beginning to use fme, thanks so much.

Userlevel 2
Badge +17

Hi takashi

Thanks for the swift response, I am still a bit unsure on what to do, I have attached the JSONFragmenter however no features have been written. I am trying to parse each object's field so that each row would contain a object with the relevant attributed inserted ie type, id, speedlimit. I am just beginning to use fme, thanks so much.

@latias9787, did you check whether the contents in the JSON document are fragmented and flattened by the JSONFragmenter, using FME Data Inspector? If the transformer worked as expected, attributes prefixed by "properties." (e.g. "properties.speedLimit", "properties.webLinkUrl" etc.) must be shown in the Feature Information window when you select a feature in the Table View.

Userlevel 2
Badge +17

Hi takashi

Thanks for the swift response, I am still a bit unsure on what to do, I have attached the JSONFragmenter however no features have been written. I am trying to parse each object's field so that each row would contain a object with the relevant attributed inserted ie type, id, speedlimit. I am just beginning to use fme, thanks so much.

This is a simplified demo. The source JSON document can be fragmented and flattened with the JSONFragmenter, and you can check the result with the FME Data Inspector (Feature Information window). See also the attachment: jsonfragmenter-example.fmw (FME 2016.1)

FME Data Inspector - Feature Information

You can see the flattened attributes here.

Reply