Skip to main content

Hello all,

I am seeking help to configure the JSON reader, which I am not familiar with.

The JSON file is not a GeoJSON, (despite containing coordinates). Only the JSON (JavaScript Object Notation) Reader recognises it.

There are two arrays containing objects. custom_markers and markers

"custom_markers": [

{

"rating": 3,

"gallons": 0,

"marker_type": "Other",

"mileage": 0,

"longitude": "152.690125",

"latitude": "-27.976959",

"price": 0,

"date": "1563341193.242588",

"pin_color_blue": 1,

"pin_color_red": 0,

"marker_description": "",

"pin_color_green": 0.5019607843137255,

"name": "Stop 1 "

},

there are about 17 custom markers and these should be rendered as point objects

"markers": [

{

"longitude": "152.689234",

"date": "1563340968.211667",

"drive_distance": 6,

"markerDescription": null,

"drive_time": 0,

"latitude": "-27.994466",

"name": null

},

there are over a hundred markers and these should be rendered as a single polyline

I don't know how to tweak the settings of the JSON reader to read the JSON properly.

Thanks,

Nick

@nicholas, could you please share with us the file?


Sorry, the Attachment button is not working for me (I think my employer blocks pop-ups?)

But I can attempt to paste the contents directly


Hi,

Edited to add: Unless the JSON contains Geometry in a recognised format such as GeoJSON or OGC-WKT then you will have to build the geometry using appropriate Transformers in FME. So, with this in mind...

If you want to read in the Custom Markers and Markers as individual feature types then you could set the parameters on the JSON (JavaScript Object Notation) as follows:

Based on the supplied JSON snippet this will add two feature types to your canvas:

Custom Markers containing 17 features and Markers containing 1721 features.

In order to create the geometries you will need a CoordinateSystemSetter to set the appropriate coordinate system (I assumed LL84 here). You could set the CoordinateSystem directly on the reader, but I prefer to do this on the canvas as it's then more visible to the user and not hidden in the Navigator panel.

To create the Custom Markers you then need to connect a VertexCreator to create the points.

To create the Markers line feature you will need to create point geometries first, again using a VertexCreator. This can then be followed by a Sorter to sort into Ascending Time order (Point with oldest date and time, will become start of the line). A LineBuilder can then be added to join all these points together and create a single line.

Hope this helps?

Simon

 


I have now figured out how to attach the JSON file

Bus 6.json


I have now figured out how to attach the JSON file

Bus 6.json

Hi,

Thanks for attaching the JSON file. Did you require any further help or clarification with the JSON reader?

Thanks,

Simon


I have now figured out how to attach the JSON file

Bus 6.json

My best practice with JSON is to read it as text file, validate and format it (JSONValidator/JSONFormatter) and then process it (JSONExtractor/JSONFragmenter).


Reply