Skip to main content

Hi.

I have the following .json file:

{    
"0": {
        "0": {
            "Group 1": {
                "Sub 1": 0, 
                "Sub 2": 70
            }, 
            "Group 2": {
                "Sub 3": 0, 
                "Sub 4": 29
            }, 
            "Group 3": {
                "Sub 5": 136, 
                "Sub 6": 120
            }
        }, 
        "1": {
            "Group 1": {
                "Sub 1": 0, 
                "Sub 2": 76
            }, 
            "Group 2": {
                "Sub 3": 1, 
                "Sub 4": 35
            }, 
            "Group 3": {
                "Sub 5": 157, 
                "Sub 6": 115
            }
        }
},
"1": {
        "0": {
            "Group 1": {
                "Sub 1": 5, 
                "Sub 2": 72
            }, 
            "Group 2": {
                "Sub 3": 51, 
                "Sub 4": 2
            }, 
            "Group 3": {
                "Sub 5": 16, 
                "Sub 6": 20
            }
        }, 
        "1": {
            "Group 1": {
                "Sub 1": 50, 
                "Sub 2": 7
            }, 
            "Group 2": {
                "Sub 3": 17, 
                "Sub 4": 3
            }, 
            "Group 3": {
                "Sub 5": 17, 
                "Sub 6": 15
            }
        }
}
}

The JSON Reader of FME reads it like a single feature with 2 attributes:

0684Q00000ArDcCQAV.png

What I want to do is split that feature into 2. One has to have the attrbiute "0" and the other one, the attribute "1". Instead of a feature with two attributes, I need two features with one attribute each.

Is that possible? I have made a mess with JsonExploders, JsonFlatteners and friends... but no luck so far.

Thanks for any help provided!

FME Desktop 2016

Hi @oscard,

 

If you are using FME Desktop 2017, you can do that from the reader's property. It is easy and straightforward. Check the attached screenshots.

 

I hope this helps.

 

 

 


Hi @oscard,

 

If you are using FME Desktop 2017, you can do that from the reader's property. It is easy and straightforward. Check the attached screenshots.

 

I hope this helps.

 

 

 

I'm using 2016 :(

 

 


Hi @oscard, I would read the JSON document with a Text File reader (Read Whole File at Once: Yes) and then fragment the document with a JSONFragmenter.


Hi @oscard, I would read the JSON document with a Text File reader (Read Whole File at Once: Yes) and then fragment the document with a JSONFragmenter.

That's what I want!

 

 

Thanks!! It's a pretty simple solution. I need to think outside the box when reading files. I was being stubborn with the JSON Reader.

 

 


Reply