Skip to main content
Question

Struggling to extract all the flattened JSON features using the JSONFragmenter

  • February 9, 2022
  • 1 reply
  • 42 views

dangeerah

Hi all,

 

I am trying to extract the following attributes from my JSON file: "area": "perimeter""laFeatureType" (plus some others) from the attached JSON file.

 

I am using a JSONFragmenter with the query json["data"][*]  but it isn't extracting as expect (all returns with "missing" data although I can see the data within the JSON file) .

Screen shot of my fragmenter attached.

 

Any help much appreciated.

 

Thanks

 

1 reply

nielsgerrits
VIP
Forum|alt.badge.img+54

The reason this does not work is the _response_body is not valid json. I think it is RTF, (Rich Text Format). Not sure how to process this in FME. I found an 8 year old answer where a Python solution was proposed to convert to plain text.

 

If I manually remove all jibber jabber in rows 1 to 7, the first part of row 8, and all backslashes I get valid json:

{
	"type": "Feature",
	"geometry": {
		"type": "MultiPolygon",
		"coordinates": [
			[
				[
					[214452.8969869.19],
					[214453.169875.93],
					[214422.7669899.66],
					[214420.0469901.23],
					[214406.3569909.14],
					[214378.8569921.14],
					[214323.3969940.64],
					[214290.0169864.87],
					[214283.3869853.43],
					[214277.2369843.87],
					[214275.1569840.56],
					[214265.6869820.38],
					[214260.8269804.28],
					[214255.6569772.41],
					[214253.3869760.59],
					[214254.0269757.16],
					[214254.3869755.67],
					[214254.9469754.13],
					[214255.6469752.6],
					[214255.7369752.41],
					[214256.57969751.496],
					[214257.369750.72],
					[214258.3669749.67],
					[214258.769749.446],
					[214262.0469747.24],
					[214275.4469739.24],
					[214276.8869738.41],
					[214287.0669732.52],
					[214299.3869724.78],
					[214301.0769723.75],
					[214309.9369720.06],
					[214323.2769714.3],
					[214329.4469711.42],
					[21434069707.71],
					[214343.5969706.37],
					[214345.7969705.74],
					[214351.4169704.5],
					[214358.269702.8],
					[214364.469713.59],
					[214376.0269733.82],
					[214404.6469784.7],
					[214432.6769834.29],
					[214452.8969869.19]
				],
				[
					[214379.82369841.291],
					[214384.24769844.056],
					[214387.02569839.611],
					[214382.60169836.846],
					[214379.82369841.291]
				]
			]
		]
	},
	"properties": {
		"id": 5199540,
		"area": 28443.122295000387,
		"perimeter": 683.4246300438173,
		"versiondate": "2017-08-14T00:00:00.000Z",
		"make": "Natural",
		"descriptivegroup": ["General Surface"],
		"descriptiveterm": ["Agricultural Land"],
		"laFeatureType": "g"
	},
	"id": "84252413-32f8-4700-948a-4a5a3d2c9ace"
}

I often use JSONlint to fix this stuff manually.

 

Edit: I have only one rtf sample, but my guess is that the data is always in the last row. So you could read it with a text reader, keep only the last row, remove everything before the first "{", remove all backslashes...


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