Solved

Extracting nested object with JSONExtractor, issue with booleans?

  • 23 April 2019
  • 4 replies
  • 10 views

Badge +3

Hi folks,

While I was extracting a nested JSON object using the JSONExtractor, it seemed like I stumbled upon an issue. Consider the following JSON:

{
    "integer_0": 2019,
    "string_0": "hello",
    "boolean_0": false,
    "nested_item": {
        "integer_1": 2020,
        "string_1": "bye",
        "boolean_1": true
    }
}

When I use the JSONExtractor with target attribute 'boolean_0' and JSON Query 'json["boolean_0"]', it creates an attribute 'boolean_0' with value 'false'. So far so good.

If I however use the JSONExtractor with target attribute 'nested_item' and JSON Query 'json["nested_item"]', it creates an attribute 'nested_item' with value:

{
    "integer_1": 2020,
    "string_1": "bye",
    "boolean_1": 1
}

In this case it thus seems that the boolean value of the json object 'boolean_1' is converted from 'true' to '1'. When using the JSONFragmenter I don't experience this automatic conversion.

 

Am I overlooking something and is this intended behaviour for the JSONExtractor, or is this some kind of bug?

 

Thoughts on the matter are appreciated.

 

Kind regards,

 

Thijs

 

ps. attached is a workspace that illustrates the issue: 

 

icon

Best answer by debbiatsafe 23 May 2019, 23:27

View original

4 replies

I just stumbled on this issue while migrating an old workspace from FME 2014 to 2018.1.2 and can confirm this behavior. Looks like a software bug to me.

Userlevel 3
Badge +17

Hi @thijsknapen and @offermann82

I'm sorry you ran into this issue. I was able to reproduce the behaviour reported in 2018.x, 2019.0, 2019.1 and have filed a bug report tracking this issue.

Once the issue has been resolved, I will post an update to this Forum post.

Userlevel 3
Badge +17

Hi @thijsknapen and @offermann82

I'm pleased to say this issue has been fixed in the latest released build of FME 2019.0 and FME 2019.1 betas. You can access the installers at www.safe.com/downloads Thanks!

Badge +3

Hi @thijsknapen and @offermann82

I'm pleased to say this issue has been fixed in the latest released build of FME 2019.0 and FME 2019.1 betas. You can access the installers at www.safe.com/downloads Thanks!

Great to hear :)

Reply