Skip to main content
Solved

Basic JSON to tabular format. I can't work out how to take contents of an array and map to fields.

  • November 26, 2020
  • 1 reply
  • 11 views

I am new to this and learning but...

I have a JSON object and am trying to extract the attributes to load to PostGreSQL and I am hitting my head against a wall.

 

The format of the JSON is generally as so:

 

{
    model: 1,
    version: 2,
    content: [
        {
            x=1,
            y=2
        },{
            x=3,
            y=4
        }
    ]
}
 

I want to output something along the lines of:

model, version,   x,    y

1,            2,                1,   2

1,            2,                3,   4

 

For the life of ne I cannot work it out, to me the documentation and step by steps are not clear. 

I am using a standard JSON reader. Whatever I try, flattener, fragmentation, I cannot opreate on the content.

I had an instance where I managed to get all extracted using an extractor but this would populate the attributes for each item in the content array and concat together to look like this:

model, version,   x,    y

11,            22,          13,  24

 

The real JSON is a lot more complicated but at this very basic level, I am still not there.

Best answer by jdh

Assuming actual valid json (which the above sample isn't for a couple of reasons) you can use an JSONExtractor followed by a JSONFragmenter to get the desired output.

 

json

View original
Did this help you find an answer to your question?

1 reply

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • Best Answer
  • November 26, 2020

Assuming actual valid json (which the above sample isn't for a couple of reasons) you can use an JSONExtractor followed by a JSONFragmenter to get the desired output.

 

json


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