Skip to main content

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 jsons"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

     

  • 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": r
    e
    r
    :214452.89, 69869.19],
    n214453.1, 69875.93],
    b214422.76, 69899.66],
    <214420.04, 69901.23],
    <214406.35, 69909.14],
    ,214378.85, 69921.14],
    ]214323.39, 69940.64],
    4214290.01, 69864.87],
    1214283.38, 69853.43],
    .214277.23, 69843.87],
    4214275.15, 69840.56],
    5214265.68, 69820.38],
    8214260.82, 69804.28],
    9214255.65, 69772.41],
    6214253.38, 69760.59],
     214254.02, 69757.16],
    Â214254.38, 69755.67],
    ,214254.94, 69754.13],
    2214255.64, 69752.6],
    .214255.73, 69752.41],
    4214256.579, 69751.496],
    .214257.3, 69750.72],
    5214258.36, 69749.67],
    5214258.7, 69749.446],
    1214262.04, 69747.24],
    1214275.44, 69739.24],
    2214276.88, 69738.41],
    [214287.06, 69732.52],
    214299.38, 69724.78],
    214301.07, 69723.75],
    214309.93, 69720.06],
    214323.27, 69714.3],
    >214329.44, 69711.42],
    /214340, 69707.71],
    <214343.59, 69706.37],
    <214345.79, 69705.74],
    ,214351.41, 69704.5],
    <214358.2, 69702.8],
    7214364.4, 69713.59],
    .214376.02, 69733.82],
    4214404.64, 69784.7],
    2214432.67, 69834.29],
    .214452.89, 69869.19]
    ],
    /
    0214379.823, 69841.291],
    .214384.247, 69844.056],
    8214387.025, 69839.611],
    214382.601, 69836.846],
    1214379.823, 69841.291]
    ]
    ]
    ]
    },
    "properties": {
    "id": 5199540,
    "area": 28443.122295000387,
    "perimeter": 683.4246300438173,
    "versiondate": "2017-08-14T00:00:00.000Z",
    "make": "Natural",
    "descriptivegroup": r"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...


    Reply