Skip to main content
There must be an easy way to read a JSON file like the one I have below, and create a stream of feature objects, each with the attributes (idx, type, path, date) but I am missing how to do this (FME2014). 

 

 

If I use the JSON reader, I get a flattened list with lots of attributeX values. (yes, that is what the doc says it does).

 

 

I see some examples of people using the FileTextReader and then JSONFlatten  it out and exposing attributes. Is that the way to go? I think this should be easy, and yes, the path is a windows UNC, so I want to be able to use the in the RasterReader transform, I hope it understands UNCs.

 

 

{  "Zoom" : 9,  "CenterLat" : 50.055084228515625,  "CenterLon" : 19.938812255859375,  "FrameList" : i   {    "idx" : "22504704",    "type" : "CIB10",    "path" : "\\\\\\\\TEST-EGPL\\\\F\\\\SIS\\\\NGA\\\\CIB\\\\CB10S0009601\\\\RPF\\\\N51E020\\\\000MJ046.I13",    "date" : "1995-03-06T06:43:06.000Z"   },   {    "idx" : "22504705",    "type" : "CIB10",    "path" : "\\\\\\\\TEST-EGPL\\\\F\\\\SIS\\\\NGA\\\\CIB\\\\CB10S0009601\\\\RPF\\\\N51E020\\\\000MJ126.I13",    "date" : "1995-03-06T06:43:07.000Z"   },   {    "idx" : "22504706",    "type" : "CIB10",    "path" : "\\\\\\\\TEST-EGPL\\\\F\\\\SIS\\\\NGA\\\\CIB\\\\CB10S0009601\\\\RPF\\\\N51E020\\\\000MJ226.I13",    "date" : "1995-03-06T06:43:08.000Z"   },   {    "idx" : "22504708",    "type" : "CIB10",    "path" : "\\\\\\\\TEST-EGPL\\\\F\\\\SIS\\\\NGA\\\\CIB\\\\CB10S0009601\\\\RPF\\\\N51E020\\\\000MJ326.I13",    "date" : "1995-03-06T06:43:08.000Z"   },

 

........

 

 

 

 

 

 

Hi,

 

 

FileTextReader and then JSONFlatten  it out and exposing attributes. Is that the way to go? I think this should be easy

 

 

Well that is easy, with just 3 transformers (JSONFlattener, AttributeExposer and ListExploder) you have all of your attributes available.

 

 

Itay
Yes, I got it to work with 4 transformers and the FileTextReader (see below) but usually things in FME are more intuitive. I would have expected that the JSONReader would "actually" have been useful in reading JSON, and it could do a simple thing like  this in one step.

 

 

I only say this because the SAFE folks once asked me to report back on things that take too long, and if there is any collapsing of controls that would be useful.

 

 

Are you listening SAFE?

 

  1. JSON Flattener
  2. Attribute Remover
  3. List Exploder
  4. Attribute Exposer

 

 


Reply